Hello,
how can synchronize the combobox with my p_name field that all p_name data can be avalaible in combobox list?
Im doing select in sql then in the combobox <option> echo"$p_name"; </option> but it didnt select all data from p_name.
any advice please?
Thanks a lot
Combobox with db field
Moderator: General Moderators
Re: Combobox with db field
SHow us your mysql query and remove the "s from the var name.
-
Arsench2000
- Forum Commoner
- Posts: 38
- Joined: Sat Sep 15, 2007 8:18 pm
Re: Combobox with db field
thanks for replay.
my sql is a simple sql
then doing echo in the combobox option.
my sql is a simple sql
Code: Select all
$sql=mysql_query("select * from t")
while($r= etc...)
$p_name =$r["p_name"];
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Combobox with db field
You can output your results in a select element:
Code: Select all
echo'<select name="mySelect">';
while($row=mysql_fetch_array($query))
{
echo'<option value="'.$row['value'].'">'.$row['display'].'</option>';
}
echo'</select>';
-
Arsench2000
- Forum Commoner
- Posts: 38
- Joined: Sat Sep 15, 2007 8:18 pm
Re: Combobox with db field
Thank you very much, thats working very good, thanks againaceconcepts wrote:You can output your results in a select element:
Code: Select all
echo'<select name="mySelect">'; while($row=mysql_fetch_array($query)) { echo'<option value="'.$row['value'].'">'.$row['display'].'</option>'; } echo'</select>';