Thanks for the reply,
I have a database table called 'locations' which consists of 7 rows as follows:
locationID
store
street
suburb
state
postcode
country
I've created the form that the user fills out. As you suggested, this form also contains a select menu which is being populated with the two store names from my locations table.
I also manually inserted a hidden field in the form as follows but I don't know whether I was supposed to do this via a dialogue box?:
<input type="hidden" name="locationID" value="<?php
echo $row_rstLocations['locationID']; ?>"/>
The following is the sql used for the first query to populate the select menu:
mysql_select_db($database_locations, $locations);
$query_rstLocations = "SELECT locationID, store FROM locations";
$rstLocations = mysql_query($query_rstLocations, $locations) or die(mysql_error());
$row_rstLocations = mysql_fetch_assoc($rstLocations);
$totalRows_rstLocations = mysql_num_rows($rstLocations);
After that I created another recordset with the following sql:
SELECT *
FROM locations
WHERE locationID = $row_rstLocations['locationID']
But I got the following error:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '['locationID'] at line 1"
Can you tell me what I might be doing wrong?
In addition to the above method, I tried assigning the selected destination to a variable as follows:
$location = $_POST['locationID'];
I then tried the following sql syntax:
SELECT *
FROM locations
WHERE locationID = $location
But I got another sql syntax error:
"Unknown column '$location' in WHERE clause"
Any help much appreciated.