Hey,
Ok using this drop down list to automatically change URL's. This form is the on the page "meetings-choose.php" and the output page of this data is called is "meetings.php".
<form name="areaselect">
<select name="area" onChange="location=document.areaselect.area.options[document.areaselect.area.selectedIndex].value;" value="GO">
<?
// Creates the Person dropdown
while ($row = mysql_fetch_array($result))
{
$subarea_name = $row['subarea_name'];
echo("<option value=meetings.php?data=$subarea_name&type=area>$subarea_name</option>\n");
}
?>
</select>
</form>
Now, for example, if $subarea_name was "Hello, You", when it does the query on the meetings.php page, it gives this error:
Error in query: SELECT * FROM SECTIONS WHERE id=4. You have an error in your SQL syntax near '= 'Hello,'' at line 1
This is the query code on "meetings.php", which is used above:
/* generate sql query */
$meeting = "SELECT * FROM MEETINGS WHERE $type = '$data'";
$meetingresult = mysql_query($meeting)or die ("Error in query: $query. " . mysql_error());
Any ideas? Works fine if the variable equals one word for example "Hello" but if you put a comma or space it causes problems.
Cheers,
Chris