Hallo helpers
I have a simple drop down menu that pass a value to a php script. If, from this script, I return to the previous page I want the selected value to be displayed again.
here the form: order_form_select.php
<?php
session_start();
echo "<form name=\"aaaa\" method=\"post\" action=\"order_select.php\">";
echo '<select name="quantity1">
<option value="0" >0 </option>
<option value="6">6 </option>
<option value="12">12</option>
<option value="18">18</option>
</select>
item1 for 10$<br/><br />'."\n";
echo '<input name="submit" type="submit" value="order">';
print '</form>';
?>
I have learned from a previous thread that I have to use superglobal:something like
htmlspecialchars($_POST["quantity1"], but I do not know where to place it in the script and how.
Here the script: order_select.php
<?php
session_start();
$_SESSION['quantity1'] = $_POST['quantity1'];
?>
<?php
$quantity1 = $_POST['quantity1'];
print "you ordered $quantity1 item1 .<br />";
?>
<input type="submit" name="submit" style="background-color:#00CC66" value=" I confirm my order" onClick="location.href='confirm.php'">
<input type="submit" name="submit" style="background-color:#FF0000" value=" I change my order" onClick="location.href='order_form_select.php'">
Thanks for your precious help.