Jump to content

[SOLVED] search form coding help


h4r00n

Recommended Posts

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>";

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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!

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.