PHP Form Input

Reply

Join Date: Jun 2004
Posts: 1
Reputation: niemad is an unknown quantity at this point 
Solved Threads: 0
niemad niemad is offline Offline
Newbie Poster

PHP Form Input

 
0
  #1
Jun 17th, 2004
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....
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 1,135
Reputation: samaru is just really nice samaru is just really nice samaru is just really nice samaru is just really nice 
Solved Threads: 5
Team Colleague
samaru's Avatar
samaru samaru is offline Offline
a.k.a inscissor

Re: PHP Form Input

 
0
  #2
Jun 17th, 2004
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:
  1.  
  2. search.php?query=ninjas
Then, all you have to do to retrieve it is:
  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
Check out my blog at http://www.shinylight.com for more stuff about web dev.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC