sarabjit Posted March 25, 2006 Share Posted March 25, 2006 i'm at my wits end to solve this thing...i have a simple form with only one field (userQuery) on one page which is being analyzed in the next...here's the form:[b] <form action="search.php" method="get"> <tr><td colspan="2"><div align="center"> <input name="userQuery" type="text" id="userQuery" size="86"> </div></td></tr> <tr><td width="225"><input type="submit" name="Submit" value="Search"></td> </tr> </form>[/b]and here's the code in search.php which picks this query:[b]<?phpif (isset($userQuery)) { ...}else { ...}?>[/b]the condition isset ($userQuery) however is always resulting in false, even though my address bar shows:http://.../search.php?userQuery=test&Submit=SearchAny ideas?? Quote Link to comment Share on other sites More sharing options...
Hooker Posted March 25, 2006 Share Posted March 25, 2006 try:[code]if (isset($_GET['userQuery'])) [/code] Quote Link to comment Share on other sites More sharing options...
sarabjit Posted March 25, 2006 Author Share Posted March 25, 2006 it worked!! thanks!!will i need to do this for every variable?? Quote Link to comment Share on other sites More sharing options...
Hooker Posted March 25, 2006 Share Posted March 25, 2006 if your getting info from the URL it always helps :) Quote Link to comment Share on other sites More sharing options...
sarabjit Posted March 25, 2006 Author Share Posted March 25, 2006 Thanks!! Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted March 25, 2006 Share Posted March 25, 2006 [!--quoteo(post=358288:date=Mar 25 2006, 05:45 PM:name=sarabjit)--][div class=\'quotetop\']QUOTE(sarabjit @ Mar 25 2006, 05:45 PM) [snapback]358288[/snapback][/div][div class=\'quotemain\'][!--quotec--]Thanks!![/quote]just to elaborate on what Hooker said, ALWAYS ALWAYS ALWAYS use $_GET if refering to a URL parameter. and ALWAYS ALWAYS ALWAYS use $_POST if refering to variables posted by a form.i've been done over with this in the past, as not paying attention to where you want the variables to come from can lead to all sorts of problems. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.