nec9716 Posted April 1, 2008 Share Posted April 1, 2008 All night I have try to set up a simple table with 2 dropdown menu under Driver#1 and Driver#2 with no success.... <?php echo "<table width='60%' align='center' cellpadding='0' cellspacing='0'> <tr> <td ><b>Driver # 1:</b></td> <td ><b>Driver # 2:</b></td> </tr>"; echo "</table>"; //--Create 1 listbox. echo '<select name="DropDown1" size="1" onchange="setItemListBox()">'; while($row = mysql_fetch_array($result1, MYSQL_NUM)) { if($row[0] == $driver1) echo '<option value="' . $row[0] . '" selected>' . $row[1] . '</option>'; else echo '<option value="' . $row[0] . '">' . $row[1] . '</option>'; } echo '</select>'; //--End 1 listbox //--Create 2 listbox. echo '<select name="DropDown2" size="1" width="50">'; while($row = mysql_fetch_array($result2, MYSQL_NUM)) { if($row[0] == $driver2) echo '<option value="' . $row[0] . '" selected>' . $row[1] . '</option>'; else echo '<option value="' . $row[0] . '">' . $row[1] . '</option>'; } echo '</select>'; //--End of 2 listbox. ?> (edited by kenrbnsn to add tags) Link to comment https://forums.phpfreaks.com/topic/98918-table/ Share on other sites More sharing options...
zenag Posted April 1, 2008 Share Posted April 1, 2008 do this..... u have to create <tr> & <td> like this.... <?php echo "<table width='60%' align='center' cellpadding='0' cellspacing='0'> <tr> <td ><b>Driver # 1:</b></td> <td ><b>Driver # 2:</b></td> </tr>"; //--Create 1 listbox. echo "<tr>"; echo "<td >"; echo'<select name="DropDown1" size="1" onchange="setItemListBox()">'; while($row = mysql_fetch_array($result1, MYSQL_NUM)) { if($row[0] == $driver1) echo '<option value="' . $row[0] . '" selected>' . $row[1] . '</option>'; else echo '<option value="' . $row[0] . '">' . $row[1] . '</option>'; } echo '</select>'; echo "</td >"; //--End 1 listbox //--Create 2 listbox. echo "<td >"; echo '<select name="DropDown2" size="1" width="50">'; while($row = mysql_fetch_array($result2, MYSQL_NUM)) { if($row[0] == $driver2) echo '<option value="' . $row[0] . '" selected>' . $row[1] . '</option>'; else echo '<option value="' . $row[0] . '">' . $row[1] . '</option>'; } echo '</select>'; echo "</td >"; echo "</tr>"; echo "</table>"; //--End of 2 listbox. ?> Link to comment https://forums.phpfreaks.com/topic/98918-table/#findComment-506188 Share on other sites More sharing options...
nec9716 Posted April 1, 2008 Author Share Posted April 1, 2008 ok sound good thank's Like you must know I'm fairly new at this so: I know echo will show something on the screen if I want to remove the echo is there an easy way to do that? Link to comment https://forums.phpfreaks.com/topic/98918-table/#findComment-506822 Share on other sites More sharing options...
zenag Posted April 2, 2008 Share Posted April 2, 2008 sorry..friend...I dont know other than using echo at this kind of situation..... Link to comment https://forums.phpfreaks.com/topic/98918-table/#findComment-507132 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.