Remembering form values after submit

Text field:
<input type=”text” name=”Fname” value=”<?php echo isset($_POST[‘Fname’]) ? $_POST[‘Fname’] : ” ?>” >

Radio button:
<input type=”radio” value=”Fvalue” name=”field_name” <?php if(isset($_POST[‘field_name’]) && $_POST[‘field_name’] == ‘Fvalue’) echo ‘ checked=”checked”‘; ?>  >

Select boxes:
<?php if(isset($_POST[‘field_name’]) && $_POST[‘field_name’] == ‘some value’)   echo ‘ selected=”selected”‘;?>

For the default value add also:
<?php if(!isset($_POST[‘field_name’])) echo ‘ selected=”selected”‘;?>

Leave a Reply

Your email address will not be published. Required fields are marked *