keep user input in form after a submit
Posted: Tue Mar 08, 2011 4:28 pm
hello all, i have a php form with multiple submits (one calculates price, one checks date and one submits the form and the data to mysql database)
when i hit calculate price, for example, the function works fine but all the fields are cleared and i would like for all the input to remain as the user sent.
here is part of the code (the form):
thanks for the help
when i hit calculate price, for example, the function works fine but all the fields are cleared and i would like for all the input to remain as the user sent.
here is part of the code (the form):
Code: Select all
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<fieldset>
<legend ><span><a>video</span></a></legend>
<ol>
<li>
<label for="hover_camera">hover camera</label>
<input id="hover_camera" type="radio" name="hover_camera" value="yes" /><b>yes</b>
<input id="hover_camera" type="radio" name="hover_camera" value="no" /><b>no</b>
</li>
<li>
<label for="video_photographers">video photographers</label>
<input id="video_photographers" type="text" name="video_photographers" maxlength="1" size="1"/>
</li>
<li>
<label for="video_edit">video edit</label>
<input id="video_edit" type="radio" name="video_edit" value="short" /><b>short</b>
<input id="video_edit" type="radio" name="video_edit" value="long" /><b>long</b>
</li>
<li>
<label for="video_clip">video clip</label>
<select name="video_clip">
<option value="no">no</option>
<option value="regular">regular</option>
<option value="staged">staged</option>
</select>
</li>
</ol>
</fieldset><br />
<fieldset align="right">
<legend><span><a>stills</span></a></legend>
<ol>
<li>
<label for="stills">stills</label>
<input id="stills" type="text" name="stills" maxlength="1" size="1" />
</li>
<li>
<label for="increase">increase amount</label>
<input id="increase" type="text" name="increase" maxlength="4" size="1" />
</li>
<li>
<label for="magnets">magnets</label>
<input id="magnets" type="text" name="magnets" maxlength="4" size="1" />
</ol>
</fieldset><br />
<fieldset align="right">
<legend><span><a>albums</span></a></legend>
<ol>
<li>
<label for="digital_album">digital album</label>
<input id="digital_album" type="radio" name="digital_album" value="yes" /><b>yes</b>
<input id="digital_album" type="radio" name="digital_album" value="no" /><b>no</b>
</li>
<li>
<label for="photo_album">photo album</label>
<input id="photo_album" type="radio" name="photo_album" value="yes" /><b>yes</b>
<input id="photo_album" type="radio" name="photo_album" value="no" /><b>no</b>
</li>
<li>
<label for="small_digital_album">small digital album</label>
<input id="small_digital_album" type="radio" name="small_digital_album" value="yes" /><b>yes</b>
<input id="small_digital_album" type="radio" name="small_digital_album" value="no" /><b>no</b>
</li>
</ol>
</fieldset><br />
<fieldset align="right">
<ol>
<li>
<label for="comments">comments</label>
<textarea id="comments" name="comments"></textarea><br /><br />
</li>
<li>
<label for="price">price</label>
<td><input type="submit" id = "price" name="price" value="calculate price" /></td>
</li>
</ol>
</fieldset><br />
<fieldset align="right">
<legend><span><a>choose date</span></a></legend>
<ol>
<li>
<input type="submit" id="isavailable" name="isavailable" value="isavailable" />
</li>
</ol>
</fieldset>
<fieldset class="submit">
<ol>
<li>
<input class="submit" type="submit" id="submit" name="submit" value="done!" /> <input class="submit" type="reset" id="reset" name="reset" value="reset" />
</li>
</ol>
</fieldset>
</form>