Jump to content

table.....


nec9716

Recommended Posts

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

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

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.