Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

novice PHP scripter STUCK

Status
Not open for further replies.

Elmserv

Programmer
Sep 25, 2004
72
GB
I am trying to create a list box that is populated by a table.

The basic HTML code is

*-*
<TD><select name="driver" class="textarea" maxlength="50"><option value="100">Fred</option><option value="101">Flossie</select></TD>
*-*

I have created PHP code to buld the whole string

*-*
$cList = '<TD><select name="driver" class="textarea" maxlength="50">';

$cQuery = "SELECT `driver`,`name`,`vantype` FROM `drivers`";

$res = mysql_query($cQuery,$cMysql);
if ($res){

while ($row = mysql_fetch_array($res, MYSQL_NUM)){
$cList.= '<option value="' ;
$cList.= strval($row[0]);
$cList.= '"';
$cList.= '>';
$cList.= $row[1];
$cList.= '</option' ;


}

}
$cList.= '</select></TD>' ;
*-*

I have left out some bits to improve clarity, I am using macromedia to edit the file, the machine is XP & I have the databases & PHP set up on my webserver which is many miles away
 
It might help if you told us exactly what isn't working. Other than the missing > on your </option> tag, nothing jumps out at me as obviously wrong.
 
Thanks

That seems to have corrected it, only been playing with it for 12 hours.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top