Reputation: 497
As the title says, i'm trying to retain the value submitted from a text form. so I thought the following simple code on the pre-process page would do the trick but the text box is still blank.
<form id="form1" name="form1" method="get" action="pre_process.php">
<input name="q" type="text" value="<?php $_GET['q']; ?>" size="80"/>
Any suggestions?
Thanks
Upvotes: 2
Views: 1714
Reputation: 10732
Try:
<input name="q" type="text" value="<?php echo $_GET['q']; ?>" size="80"/>
You need to echo the value out.
To avoid Notices you should use the isset function to check if the value was set
Your code should look like:
<input name="q" type="text" value="<?php echo isset($_GET['q']) ? $_GET['q'] : NULL; ?>" size="80"/>
Upvotes: 8