Hey guys, I am just learning php and mysql for the first time and I would really appreciate your help. I have created a search engine for my website which searches through a database and then returns the correct results. All of that is working great, EXCEPT for the fact that I want the results to be printed on a new page. I know how to redirect to a new page by uing header(Location: url), BUT when I redirect to the new page, it will not print out the results on the new page. Instead it is printing an error (Warning: mysql_fetch_array(): supplied argument is not a valid MySQL), which tells me that it is not reading any of the variables from the previous page. Can anyone give me any advice for how to perform a search on one page, and then redirec the output to a new page?? Thanks a lot guys.
still_learning
0
Junior Poster in Training
Recommended Answers
Jump to Posthave the search form post to the new page you are talking about and process/display the results on that page.
Jump to Postput the search key in a $_GET variable then perform the query in the header location page":
$var=$_POST['searchtext']; header("Location: http://www.example.com?var=$var");
Jump to Postcan you post the form? if so, then i can type some code up for you, so you can see how to do it.
All 9 Replies
somedude3488
228
Nearly a Posting Virtuoso
ryan_vietnow
13
Posting Pro
still_learning
0
Junior Poster in Training
somedude3488
228
Nearly a Posting Virtuoso
ryan_vietnow
13
Posting Pro
still_learning
0
Junior Poster in Training
ryan_vietnow
13
Posting Pro
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
still_learning
0
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.