It doesn't like the curly brackets either! Brad -----Original Message----- From: Jim Lucas [mailto:lists@xxxxxxxxx] Sent: Tuesday, June 12, 2007 12:39 PM To: BSumrall Cc: php-general@xxxxxxxxxxxxx Subject: Re: Looking for help with forms/variables and an array! BSumrall wrote: > I am sure I am on the right track. > Register globals is turned on! > > I am getting 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 '[''] LIMIT 0, 1' > at line 1 > > mysql_select_db($database_ftn, $ftn); > @extract($_POST); > $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range= > '[$select1]'"; $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = '[$select1]'"; Why do you have brackets in this statement? Are they actually in the data that way? Try this, curly braces: $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = '{$select1}'"; > > I am trying to get a php form variable into the above sql query. > '[$select1]' if changed back to the number 1 will bring up a record just > fine. > Putting in a variable produces the error. > > How do I get a php form variable into a sql query? > > Below is my form > > > > <form id="form1" name="form1" method="post" action="index_dev.php"> > <label>market > <select name="select1"> > <OPTION value="1">Indiana</OPTION> > <OPTION value="2">Wisconsin</OPTION> > <OPTION value="3">Illinois</OPTION> > <OPTION value="4">Michigan</OPTION> > <OPTION value="5">Georgia</OPTION> > <OPTION value="6">Florida</OPTION> > </select> > </label> > </form> > > > Brad > > > > > >> Interesting suggestion. >> >> I though ajax was mainly gear towards microsoft and javascripting >> applications? >> >> >> -----Original Message----- >> From: George Pitcher [mailto:george.pitcher@xxxxxxxxxxx] >> Sent: Tuesday, June 12, 2007 5:42 AM >> To: BSumrall >> Subject: RE: Looking for help with forms/variables and an array! >> >> Hi, >> >> Have you looked at Ajax? This will do just what you have >> described. When the >> user makes their first choice, Ajax queries the database to return the >> options for the secont drop-down box. >> >> George >> >>> -----Original Message----- >>> From: BSumrall [mailto:Brads@xxxxxxxxx] >>> Sent: 12 June 2007 9:34 am >>> To: php-general@xxxxxxxxxxxxx >>> Subject: RE: Looking for help with forms/variables and an array! >>> >>> >>> I got a little bit further, but still feel like the "monkey with a >>> light-bulb"! >>> >>> <OPTION value="1">Over $2 million</OPTION> >>> >>> >>> >>> -----Original Message----- >>> From: BSumrall [mailto:Brads@xxxxxxxxx] >>> Sent: Tuesday, June 12, 2007 4:21 AM >>> To: php-general@xxxxxxxxxxxxx >>> Subject: Looking for help with forms/variables and an array! >>> >>> >>> Dreamweaver help me with a good part of this, but now I am in the nitty >>> gritty code and trying to figure out. >>> >>> General concept: >>> >>> A selection box has 4 options, php queries the Mysql database >> for matching >>> options. >>> >>> Then a second options box with another 4 options filters the query even >>> more. >>> >>> Aspects I am a little stuck on. >>> >>> 1 associating options (in drop down box) with a variable >>> 2 carrying the result set over two the second drop down box >>> >>> Producing my final result set. >>> >>> Here are some snippets of where I am at. >>> >>> First selection box: >>> >>> <form id="form1" name="form1" method="post" action=""> >>> <label>market >>> <select name="select"> >>> <OPTION>option1</OPTION> >>> <OPTION>option2</OPTION> >>> <OPTION>option3</OPTION> >>> <OPTION>option4</OPTION> >>> </select> >>> >>> >>> >>> Second selection box: >>> >>> <form id="form2" name="form2" method="post" action=""> >>> <label>market >>> <select name="select"> >>> <OPTION>option1</OPTION> >>> <OPTION>option2</OPTION> >>> <OPTION>option3</OPTION> >>> <OPTION>option4</OPTION> >>> </select> >>> >>> >>> $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE range = '1'"; >>> >>> The number one is what the first set of just above is what form one is >>> supposed to change. >>> >>> After that, how is the world am I going to do it twice for the >> second part >>> of the query? >>> >>> Some good literature on how to do it TWICE would really help understand >>> this. >>> >>> I find tons of stuff on doing it once! >>> >>> Thank you kindly for any guidance you can provide. >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >> >> >> > -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php