943,789 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 16705
  • PHP RSS
Jun 17th, 2004
0

PHP Form Input

Expand Post »
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['festname'];
echo "'>";

and this:

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

will someone help me please, i will be very grateful....
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
niemad is offline Offline
1 posts
since Jun 2004
Jun 17th, 2004
0

Re: PHP Form Input

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:
PHP Syntax (Toggle Plain Text)
  1.  
  2. search.php?query=ninjas
Then, all you have to do to retrieve it is:
PHP Syntax (Toggle Plain Text)
  1.  
  2. $_GET['query']
So for your code, it'd be something like this:
[php]
echo "<input type='hidden' name='hiddenField' value = '";
echo $_GET['query'];
echo "'>";
[/php]

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

http://www.daniweb.com/techtalkforums/thread199.html
Team Colleague
Reputation Points: 262
Solved Threads: 18
a.k.a inscissor
samaru is offline Offline
1,227 posts
since Feb 2002

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: phpbb2.X news?
Next Thread in PHP Forum Timeline: limiting account names





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC