Forum Moderators: open
My problem is this -- I've managed to figure out how to retain the information in standard text/text-area form fields (see below), but the "Select Tag" drop-down list reverts back to the default ("Select a City") once the preview button is selected. I can't figure out how to retain the drop-down list user selected option when the Preview button is hit. In the "Preview" area, the selected "option" is shown, but the value in the actual drop-down list does not remain.
I'm sure there is a "java" solution? Please! Any ideas? Below is an example of the form setup and preview function. Gracias!
///// FORM INPUT
<form name="customer" action="<?=$_SERVER['PHP_SELF']?>" method="post">
<input type="text" name="fname" value="<?=stripslashes($_POST['fname'])?>">
<input type="text" name="lname" value="<?=stripslashes($_POST['lname'])?>">
<SELECT name="area">
<OPTION value="None">Select a City</OPTION>
<OPTION value="1">London</option>
<OPTION value="2">Paris</OPTION>
<OPTION value="3">New York</OPTION>
</SELECT>
<input type="submit" value="Preview" name="preview">
<input type="submit" value="Submit" name="submit">
</form>
///// PHP CODE FOR PREVIEW
<?
if ($_POST['preview']) {
$locale = $_POST[area];
echo $locale;
echo stripslashes ($_POST['fname']);
echo stripslashes ($_POST['lname']);
}
?>
By the way, Java has next to nothing to do with JavaScript.