Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form issue

Status
Not open for further replies.

byleth

Programmer
Feb 27, 2004
70
PT
Hi,

I have a simple form that upon clicking on a submit button reverts to the same page.

The form has a text box and some chekboxes.

Is there a way to keep the text in the textbox and the checkboxes that were selected, on the page (wich is the same) after submitting the form?

thanks...

 
sure there is ...


<input type="text" name="text_field_name" value="<?php echo $text_field_name; ?>">
<input type="checkbox" name="cb_name" value="2"<?php echo (($cb_name==2)?' checked':''); ?>>

hope this helps
 
Caveat:

The example that netcomander gives is based on the assumption that register_globals is ON. However, for some time now (I think 4.1.0) register_globals is OFF by default. Read in the PHP manual why:

So, you need (and should) use either $_GET['text_field_name'] or $_POST[...] or $_REQUEST[...].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top