103 Posts
shubhaanshu
10 years ago
6
Topic
Hi friends!
I want to use core 42 field to put custom php code in my form, is there any guide or tutorial from which we can understand how to do it?
Regards,
Get a VIP membership
103 Posts
shubhaanshu
10 years ago
2
Level 1
I have created a core 42 field and added some code in prepare form text area:
$con=mysqli_connect("localhost","root","password","dbname");
echo $form = "<select id='gvid' name='gvid' ><option value=''> --Select-- </option>";
$sql = mysqli_query($con,"SELECT * FROM `qmebd_cck_store_form_m_block` LIMIT 0, 30");
while($result = mysqli_fetch_array($sql))
{
echo "<OPTION VALUE='".$result[0]."'>".$result[0]."</OPTION>";
}
echo "</select>";
It is working! and showing a select field in form, But not in the right place assigned to the field. the select field is showing at the top of the form.
at the right position I am getting one more select field which is showing only ---select--- option.
Can anyone shed some light?
103 Posts
shubhaanshu
10 years ago
1
Level 3
Thanks Zwergo! I am trying that also but not getting the solution.
actually I want to use a variable in the place of static "value"
Lionel! the Plugin Field Select Dynamic. is the best option but it does not allow to use variable in "where" clause.
10 years ago
0
Level 4
Sorry,
i don't understand well what is your need.

First, i think your query is not good. you want to get "*" from the database. How do you know which variable must go on value, and which must go on text for the select.

With the select dynamic, you can write the query like that:
SELECT id AS value, id AS text FROM `qmebd_cck_store_form_m_block



and in the parameters, you can also add some static options, like " gvid=gvid ", before or after other dynamic options.

Regards.
Lionel

10 years ago
2
Level 1
Hello all,

i don't really understand why you want to use the plugin field 42 for creating a Select. For that it's better to use the Plugin Field Select Dynamic.

it's done for that!
If you choose the construction "Free", you can write your own query.

Regards.
Lionel

7 years ago
1
Level 2

I have the same problem, but I want to show the list of links. 

I use core 42, and it's ok to get data ... but shows in a wrong place. 

I do not want to use other plugin, just want to put my data on a right place. 

I try to use a $ form variable, but nothing happens.

4229 Posts
Kadministrator
7 years ago
0
Level 3

The only thing I can suggest is that you look at existing instances of fields 42 in Seblod how it is done there - go to Fields and change filter to Off, then filter by type.

Get a Book for SEBLOD