Originally posted by mote
This is my query:
$query_type = "select typeName from types";
$result_type = mysql_query($query_type) or die(mysql_error());
This is part of my form which is inside a function. For some reason I keep getting an error for the line with the <option> field. Any reason why?:
<select name=\"typeName\" size=1 class=\"inputborder\">
while ($row_type = mysql_fetch_array($result_type))
{
<option><?echo $row_type['typeName'];?><?echo $row_type['typeName'];?><option>
}
</select>
My recommendation is to stop switching into and out of PHP. It can be hard to tell where you need a open and close php tags. You're missing one right at the front of your <option> tag.
Try making it like this:
<?php
print '<select name="typeName" size="1" lass="inputborder">';
while ($row_type = mysql_fetch_array($result_type))
{
print '<option>'.$row_type['typeName'].$row_type['typeName'].'</option>';
}
print '</select>';
Also, when you post your code, use the PHP tag suppoted by the bb software, it makes it much easier for us to read it.
For cheap thrills, turn on code highlighting in apache/php and link your file like so:
ln -s filename.php filename.phps
and view it to get color coded output right away.