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

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. 

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!

 

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.

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>

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.