----- Original Message ----- 
From: "whoisquilty"

I've got a form with a pulldown on my main page. The user chooses from the 
pulldown
and that is passed to the secondary page. That variable is supposed to 
search the database
and display the results.

However, the secondary page is not getting the variable. It shows in the 
URL, but it shows
as 0 in the DB query.

Here's the form code:

<select name="var" size="1">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="E">E</option>
<snip>
Here's the code from the secondary page:

$var = floor($_GET['var']);

mysql_connect('x', 'x', 'x');

mysql_select_db('x');

$query = "SELECT *
FROM shows
ORDER BY sorttitle
WHERE begins = '$var'";

What's going on?!
-----------------------------
PHP will NOT substitute values for variables that are enclosed in single 
qoutes - use the following syntax -

$query = "SELECT *
FROM shows
ORDER BY sorttitle
WHERE begins = \'" . $var . "\'";

OR

$query = 'SELECT *
FROM shows
ORDER BY sorttitle
WHERE begins = "' . $var . '"';

can also try -

$query = "SELECT *
FROM shows
ORDER BY sorttitle
WHERE begins = '{$var}'"; 

Reply via email to