Jump to content

PHP Search To Display Page?


justlukeyou

Recommended Posts

Hi,

 

I have a website which displays products on product display pages and static pages such as 'contact us'.  I am now looking to add a search function which directs to the display page so the products are neatly presented.  However, all the tutorials I can find are based on displaying the echo on same page as the search and directing the search to another page.

 

Does anyone know how to do this?

Link to comment
Share on other sites

just code a search form into your pages

<form action = "product_display.php" method ="POST">
<label>Search</label><input type = "text" name="search" value="" /><input type="submit" value="Search" />
</form>

 

as long as your product display page knows to use $_POST['search'] to get it's result set it'll work from any page you include it on.

 

that what your looking for?

Link to comment
Share on other sites

a book would be a big help, for refference if nothing else (even a cavant would have difficulty remembering everything about php)  but if a form is involved you will POST the data from the form to your php.  if the variable atributes are comming from an outside source (such as the URL header - most commonly) then you will need php to go GET the values.  whatever method of transporting the values you choose to use, just remember that you have to use the same on both sides (only an issue with forms really) so if you are using 'method="POST" ' then you will use $_POST['varName'] to retieve the value likewise, if you use 'method="GET" ' then you will need to use $_GET['varName'] to retrieve it.  Also, some hosting only allows one or another method of trasfering values between pages, so take that into account when you are making your pages (assuming you have access to that information at designe time).

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.