Form question involving dropdown boxes
Posted: Fri Nov 06, 2009 6:15 am
Ok so I have a dropdown form with a little php after it. The php is rendering a picture based on what the user picks. This is working fine, but the page refreshes after the user selects their options. When it refreshes it resets their selections. Is there anyway I can stop it from resetting their selections?
So for example a person picks Medium, Orange, and Redbox they click render picture, that works fine. But when it renders their picture it resets their selection back the default: Small, Choose Color, None.
So for example a person picks Medium, Orange, and Redbox they click render picture, that works fine. But when it renders their picture it resets their selection back the default: Small, Choose Color, None.
Code: Select all
<center><form name="blah" id="blah" method="get">
<select name="sizes" tabindex="1">
<option value="small" id="small">Small</option>
<option value="blueshirt.png" id="medium">Medium</option>
<option value="large" id="large">Large</option>
<option value="xlarge" id="xlarge">X-Large</option>
<option value="xxlarge" id="xxlarge">XX-Large</option>
</select>
<select name="colors" tabindex="2">
<option value="" id="choose">Choose Color</option>
<option value="orange.jpg" id="orange">Orange</option>
<option value="blueshirt.png" id="blue">Blue</option>
<option value="lightblue.jpg" id="lightblue">Light Blue</option>
<option value="green.jpg" id="green">Green</option>
<option value="lightgreen.jpg" id="lightgreen">Light Green</option>
</select>
<select name="decal" tabindex="3">
<option value="" id="none">None</option>
<option value="redbox.png" id="redBox">Red Box</option>
<option value="blueBox" id="blueBox">Blue Box</option>
</select><br /><br />
<input type="submit" value="Render Picture" tabindex="4" />
</form></center>
<?php
$color = $_GET['colors'];
$decal = $_GET['decal'];
print "
<div class=\"shirt\" style=\"background-image:url(shirts/$color); background-repeat:no-repeat; height:500px; margin-left:400px; margin-top:100px;\"><br />\n
<img class=\"decal\" src=\"decals/$decal\" style=\"margin-left:100px; margin-top:50px;\" />
</div>";
?>