I am having problems making this work...
I have a field on the database that gives an option 1, 2, 3 and I want to present the results of a query differently for each of these options.
For option 1 I want to show the results of the query, plus a form text field for the client to fill in the Colour, for option 2 I want the same information, but a field for Size, and the third option to have both fields to fill in.
Whichever way I try it it always returns the results for Option 3.
I adding the $option to the results in a hidden field, but it doesn't hide this value it shows it....
Any Help Will Be Greatly Appreciated !!!
The code I am using is as follows;
$query = "SELECT (Model) AS Model, (SerialNo) AS SerialNumber , (CommonName) AS location, (Option) AS Option FROM tblBoot WHERE SectionRef = '$SectionRef' ";
$result2 = mysql_query($query)
or die ("could not find information");
if ($result2)
{
echo '<table align="centre" cellspacing="0" cellpadding="0">
<tr>
<td align="left"><b>Model</b></td>
<td align="left"><b>Serial Number</b></td>
<td align="left"><b>Location</b></td>
<td align="left"><b>Options</b></td>
<td align="left"></td>
</tr>';
while ($row2 = mysql_fetch_array($result2,MYSQL_NUM))
{
switch ($Option)
{
case '1' :
echo
"<form action=\"process.php\" method=\"post\">
<tr><font face=\"Arial, Helvetica, sans-serif\" >
<td width=\"70\" align=\"left\"> $row2[0]</td>
<td width=\"120\" align=\"left\"> $row2[1]</td>
<td width=\"200\" align=\"left\"> $row2[2]</td>
<td width=\"200\" align=\"left\"> $row2[3] <input type=\"hidden\" name=\"Option\"> </td>
<td width=\"200\" align=\"left\"> $row2[4] Colour <input type=\"text\" name=\"Colour\"> </td>
<td width=\"200\" align=\"left\"> $row2[5] </td><br>
</font></tr>\n";
break;
case '2' :
echo
"<form action=\"process.php\" method=\"post\">
<tr><font face=\"Arial, Helvetica, sans-serif\" >
<td width=\"70\" align=\"left\"> $row2[0]</td>
<td width=\"120\" align=\"left\"> $row2[1]</td>
<td width=\"200\" align=\"left\"> $row2[2]</td>
<td width=\"200\" align=\"left\"> $row2[3] <input type=\"hidden\" name=\"Option\"> </td>
<td width=\"200\" align=\"left\"> $row2[4] </td>
<td width=\"200\" align=\"left\"> $row2[5] Size <input type=\"text\" name=\"Size\"></td><br>
</font></tr>\n";
break;
case '3' :
echo
"<form action=\"process.php\" method=\"post\">
<tr> <font face=\"Arial, Helvetica, sans-serif\" >
<td width=\"70\" align=\"left\"> $row2[0]</td>
<td width=\"120\" align=\"left\"> $row2[1]</td>
<td width=\"200\" align=\"left\"> $row2[2]</td>
<td width=\"200\" align=\"left\"> $row2[3] <input type=\"hidden\" name=\"Option\"> </td>
<td width=\"200\" align=\"left\"> $row2[4] Colour <input type=\"text\" name=\"Colour\"> </td>
<td width=\"200\" align=\"left\"> $row2[5] Size <input type=\"text\" name=\"Size\"></td><br>
</font></tr>\n";
break;
}
} // close while loop
} // close if