The drop down selection should remain as it is after submit
Posted: Tue Aug 23, 2005 6:34 pm
Hello everyone,
Ive written a simple code in which a person has to select the range for two factors and click submit. a value is associated with the two values. Their sum is printed. My requirement is after the submit is clicked, the range that was selected for two questions should be displayed as it is instead of displaying the default selection. can someone help me on this.
Here is the code
feyd | Please use
Ive written a simple code in which a person has to select the range for two factors and click submit. a value is associated with the two values. Their sum is printed. My requirement is after the submit is clicked, the range that was selected for two questions should be displayed as it is instead of displaying the default selection. can someone help me on this.
Here is the code
Code: Select all
<html>
<head>
</head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
</p>
<p> </p>
What is the range of ABC
factor<select name="value1">
<option value=2>Low
<option value=5>Medium
<option value=10>High
</select></div>
</p>
</p>
<p> </p>
What is the range of DEF
factor
<select name="value2">
<option value=2>Low
<option value=5>Medium
<option value=10>High
</select>
</p>
<p> </p>
<input type="submit" name="submit" value="Submit">
</p>
<p> </p>
</form>
</body>
</html>
<?php
if (isset($_POST['submit']))
{
$v1= $_POST["value1"];
$v2= $_POST["value2"];
$v5 = $v1 + $v2;
echo "According to the selections that you have made the value is $v5";
}
?>feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]