h4r00n Posted August 24, 2009 Author Share Posted August 24, 2009 Hi, thanks for all your help. The form seems to be working, but there are some more errors: Notice: Undefined variable: x in C:\Documents and Settings\haroon\My Documents\JobJar\wamp\www\wamp\www\Pages\search.php on line 29 Notice: Undefined variable: construct in C:\Documents and Settings\haroon\My Documents\JobJar\wamp\www\wamp\www\Pages\search.php on line 32 Notice: Undefined variable: Job in C:\Documents and Settings\haroon\My Documents\JobJar\wamp\www\wamp\www\Pages\search.php on line 70 Notice: Undefined variable: Job in C:\Documents and Settings\haroon\My Documents\JobJar\wamp\www\wamp\www\Pages\search.php on line 72 Lines 29-32 are: $x++; if ($x==1) { $construct .= "Keywords LIKE '%$search_each%'"; Lines 70-72 are: $Duration<br> $Job Ref<br> $Description<p>"; Quote Link to comment https://forums.phpfreaks.com/topic/171665-solved-search-form-coding-help/page/2/#findComment-905359 Share on other sites More sharing options...
Maq Posted August 25, 2009 Share Posted August 25, 2009 Notice: Undefined variable: x in C:\Documents and Settings\haroon\My Documents\JobJar\wamp\www\wamp\www\Pages\search.php on line 29 You never initialize $x, but the script should still work properly. Notice: Undefined variable: construct in C:\Documents and Settings\haroon\My Documents\JobJar\wamp\www\wamp\www\Pages\search.php on line 32 You never initialize $construct but the script should still work properly. Notice: Undefined variable: Job in C:\Documents and Settings\haroon\My Documents\JobJar\wamp\www\wamp\www\Pages\search.php on line 70 Notice: Undefined variable: Job in C:\Documents and Settings\haroon\My Documents\JobJar\wamp\www\wamp\www\Pages\search.php on line 72 These two notices won't hurt you but you the "$Job Type" variable won't display. Change all occurrences of "$Job Type" to "$JobType" (notice the space). I would highly encourage you to never use spaces, instead use underscores if you want to separate words in variable names. You can keep the key name in the associative array from the query the same, change only the PHP variables. Quote Link to comment https://forums.phpfreaks.com/topic/171665-solved-search-form-coding-help/page/2/#findComment-905808 Share on other sites More sharing options...
h4r00n Posted August 25, 2009 Author Share Posted August 25, 2009 Notice: Undefined variable: x in C:\Documents and Settings\haroon\My Documents\JobJar\wamp\www\wamp\www\Pages\search.php on line 29 You never initialize $x, but the script should still work properly. Notice: Undefined variable: construct in C:\Documents and Settings\haroon\My Documents\JobJar\wamp\www\wamp\www\Pages\search.php on line 32 You never initialize $construct but the script should still work properly. Hi, the script works perfect, just need to format it to my liking. However, I cannot get rid of the two undefined variables above... Notice: Undefined variable: x in C:\Documents and Settings\haroon\My Documents\JobJar\wamp\www\wamp\www\Pages\search.php on line 29 Notice: Undefined variable: construct in C:\Documents and Settings\haroon\My Documents\JobJar\wamp\www\wamp\www\Pages\search.php on line 32 2 results found! Quote Link to comment https://forums.phpfreaks.com/topic/171665-solved-search-form-coding-help/page/2/#findComment-906141 Share on other sites More sharing options...
Maq Posted August 25, 2009 Share Posted August 25, 2009 Hi, the script works perfect, just need to format it to my liking. However, I cannot get rid of the two undefined variables above... That's good to hear. You have to initialize them like I mentioned before. Somewhere in the beginning of your script add: $x = 0; $construct = ""; EDIT: I realize you have error_reporting turned to max while in development, but when pushed live, error_reporting should be adjusted appropriately. Quote Link to comment https://forums.phpfreaks.com/topic/171665-solved-search-form-coding-help/page/2/#findComment-906148 Share on other sites More sharing options...
h4r00n Posted August 25, 2009 Author Share Posted August 25, 2009 YOU'RE THE MAN MAQ..! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/171665-solved-search-form-coding-help/page/2/#findComment-906157 Share on other sites More sharing options...
h4r00n Posted August 25, 2009 Author Share Posted August 25, 2009 Hey, I have my code below for the search form. Do you know how I can have pre-written text in the search field stating 'e.g. Social Work in Manchester' which disappears when the user clicks the search field? <form action='search.php' method='GET'> <center> <p><font size="5" style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 30px; color: #FF7113;">Quick Search</font></p> <p><font size="5" face="sans-serif"> <input style='text' size ='50' name='search'> <input type='submit' name='submit' value='Search' > <br> </font></p> </center> </form> Quote Link to comment https://forums.phpfreaks.com/topic/171665-solved-search-form-coding-help/page/2/#findComment-906174 Share on other sites More sharing options...
Maq Posted August 25, 2009 Share Posted August 25, 2009 I believe the "value" attribute is the default value. To make it blank when the user clicks in the field, you're going to have to use Javascript, specifically onFocus(). If this specific thread is solved, please mark as so and post this new question in the Javascript section. Quote Link to comment https://forums.phpfreaks.com/topic/171665-solved-search-form-coding-help/page/2/#findComment-906184 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.