Jump to content

[SOLVED] Trouble With Dynamic Form


refiking

Recommended Posts

I am trying to retrieve data from mysql db to as the drop down choices. Right now, I have added 2 records to the table for testing purposes.  The problem is the script as written returns 2 drop down boxes and I only want one drop down box.  Here's the code I have:

 

<form action="<?=$PHP_SELF?><?if($QUERY_STRING){ echo"?". $QUERY_STRING;}?>" method="POST">
<TABLE height="15" align="center" width="60%">
<TD>Current Customer:   <?Echo $fname . ' ' . $lname;?></TD>
<?
$sql2 = mysql_query("SELECT * FROM `log` WHERE `type` = '2'")or die(mysql_error());
while($row2 = mysql_fetch_assoc($sql2)){
$tsid = $row2['sid'];
$first = $row2['fname'];
$last = $row2['lname'];

Echo '<TD><SELECT name="sid"><option value = ' . $tsid . '">' . $lname . ', ' . $fname . '</option></SELECT></TD>';}?>
<TD><input type="submit" value="Switch Customer"></TD>
</TABLE><input type="hidden" name="change" value="yes"></FORM>

Link to comment
https://forums.phpfreaks.com/topic/126120-solved-trouble-with-dynamic-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.