| | |
PHP Form Input
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2004
Posts: 1
Reputation:
Solved Threads: 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['festname'];
echo "'>";
and this:
echo "<input type='hidden' name='hiddenField' value = '";
echo $festname;
echo "'>";
will someone help me please, i will be very grateful....
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....
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:
Then, all you have to do to retrieve it is:
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
PHP Syntax (Toggle Plain Text)
search.php?query=ninjas
PHP Syntax (Toggle Plain Text)
$_GET['query']
[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.
![]() |
Similar Threads
- PHP Form submit to email (PHP)
- PHP Form Validation ??? (PHP)
- insert data from PHP form (MySQL)
- php form - pop-up window possible? (PHP)
- Sending an image to email via PHP form? (PHP)
- Php Form (PHP)
- PHP Form mailing troubles (PHP)
Other Threads in the PHP Forum
- Previous Thread: phpbb2.X news?
- Next Thread: limiting account names
| Thread Tools | Search this Thread |
apache api array beginner binary body broken cakephp checkbox class cms code computing cron curl database date date/time delete display dynamic echo email error file files filter folder form forms function functions gc_maxlifetime global google host href htaccess html image include insert ip javascript joomla limit link list login mail memmory memory menu mlm msqli_multi_query multiple mycodeisbad mysql navigation oop parameter parsing paypal pdf php problem query radio random recourse recursion regex remote script search seo server sessions sms snippet source space sql static syntax system table thesishelp tutorial update upload url validator variable video web webdesign wordpress xml youtube






