Author Topic: Search & Results pages  (Read 2438 times)

AngelaChirps

  • Guest
Search & Results pages
« on: April 25, 2011, 03:54:12 pm »
Hello-
I'm having trouble getting my results page to work. The tutorial I've been using is for IMD331.

My question is: If we have our results on a separate page from the search, are we suppose to use the same recordset on both pages? Should everything be the same?

Under the directions from this tutorial it doesn't explain this clearly because I think it's written to have the results display on the search page. When I create a new 'results.php' file and try to insert a dynamic table it asks me to create a recordset first.

I did try and have the results display on my search page, but wasn't successful with that either.

Thanks!

erikkross

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 399
    • Personal Blog with Classroom Tutorials
Re: Search & Results pages
« Reply #1 on: April 25, 2011, 05:06:21 pm »
One problem I see in your results.php page. You have the following:

if (isset($_GET['search'])) {
  $colname_resultsRS = $_GET['search'];
}

The search needs to be capitalized to match the name of the "Search" text box from your search.php page:

if (isset($_GET['Search'])) {
  $colname_resultsRS = $_GET['Search'];
}


The search page actually doesn't need any code in it if you are not going to be displaying the results on that page. You just need the form on there that sumbits to results.php. So the code in search.php isn't hurting anything, but you could remove it if you wanted.
Erikk Ross
The Art Institute of Pittsburgh, Online Division
Web Design and Interactive Media
Full Time Faculty
eross@aii.edu

AngelaChirps

  • Guest
Re: Search & Results pages
« Reply #2 on: April 26, 2011, 08:44:07 pm »
I made the changes you suggested to the results page. However, when I entered 'boots' into the search box on the search page it did nothing. It seemed like it still wasn't submitting to the results page.

So, I decided to combine the search and result pages and started over. It seems like this time it's submitting the search, but no results show. I had to use the column product_price in my recordset (for the filter) because it was the only column name I could get results when I tested it in dreamweaver. I used 20 in my test and it worked. However, once posted to my page it did not.

Sorry, I guess this should have gone under the PHP topic?

My page: http://angelajacobs.aisites.com/imd331/search-results.php

erikkross

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 399
    • Personal Blog with Classroom Tutorials
Re: Search & Results pages
« Reply #3 on: April 27, 2011, 05:17:31 am »
Ok, I see a new problem in the search_results.php page.

Your text box is not named Search...the submit button is.

Rename the text box to search. So change this:

<input name="" type="text" value="" />

TO

<input name="Search" type="text" value="" />

Then rename the submit button from this:

<input type="submit" name="Search" id="Search" value="Search" />

TO

<input type="submit" name="SearchBtn" id="SearchBtn" value="Search" />
Erikk Ross
The Art Institute of Pittsburgh, Online Division
Web Design and Interactive Media
Full Time Faculty
eross@aii.edu

AngelaChirps

  • Guest
Re: Search & Results pages
« Reply #4 on: April 27, 2011, 10:44:42 pm »
Arrg. Turns out the WRONG tutorial was posted! I'm starting over with that one. Thanks for the help though.