0

Right first of all i'm new to php and i know that this is simple, but i just can't figure it out...

1st, I set up a php site that on the first page it has a textbox, lets say its name is text1...

I set up the sql so that the value of text1 was a criteria to serch for in the title record of the database...

Now the 1st page of results are correct but the next are wrong because the value of text1 is gone...

i've tried this:

echo "<input type='hidden' name='hiddenField' value = '";
echo $_REQUEST;
echo "'>";

and this:

echo "<input type='hidden' name='hiddenField' value = '";
echo $festname;
echo "'>";

will someone help me please, i will be very grateful....

2
Contributors
1
Reply
2
Views
13 Years
Discussion Span
Last Post by samaru
0

The best way to go about this is to keep a URL variable as you're going through the pages. So anywhere you create the link to go to the next page or back, include a variable of the search term. So something like this:

search.php?query=ninjas

Then, all you have to do to retrieve it is:

$_GET['query']

So for your code, it'd be something like this:

echo "<input type='hidden' name='hiddenField' value = '";
echo $_GET['query']; 
echo "'>";

Also, when passing variables around through the URL, always consinder SQL Injections. Click here for more info:

http://www.daniweb.com/techtalkforums/thread199.html

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.