Trouble passing value from drop down list to where clause

Drop down list code:
[php]

<?php include("menu.php"); echo "

Select a State to see the Bee Clubs

Maryland Massachusetts Michigan Minnesota Mississippi Missouri Montana Nebraska Nevada
"; ?>

[/php]

Processing page code:

[php]

<?php include("menu.php"); $con = mysql_connect("localhost","database","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("mdwvo_aaba", $con); $Select=$_POST['select']; $data = ('SELECT * FROM clubs WHERE state = "'.$Select.'", deleted = 'No' ORDER BY 'level', 'club' '); $query = mysql_query($data) or die("Couldn't execute query. ". mysql_error()); $data2 = mysql_fetch_array($query); echo $_POST[select] ?>

[/php]

Here’s the error I get no matter how I try to format the value:

Parse error: syntax error, unexpected T_STRING in /home/mdwvo/public_html/aabees.org/clubs.php on line 16

hello ohsnyder, do the below changes Massachusetts please replace state with there proper value here value='state' must be value='Massachusetts'. please do the same changes to rest of dropdown. and also change you query replace below code $data = ('SELECT * FROM clubs WHERE state = "'.$Select.'", deleted = 'No' ORDER BY 'level', 'club' ');

with below code
$data = “SELECT * FROM clubs WHERE state = '”.$Select."’, deleted =‘No’ ORDER BY ‘level’, ‘club’";

i hope this will helpful for you…
SR

Thank you very much ! I’ll put this in my archives for future reference.

Sponsor our Newsletter | Privacy Policy | Terms of Service