| Posted by Ian Davies on 06/21/06 19:57 
HelloI am struggling for a solution to clear some fields on my webpage that takes
 their values from some sessions
 My solution below works when the button is clicked twice. I sort of know why
 I have to click it twice to do the job (the first submit resets the sessions
 but this it too late to change the field values, which requires another
 submit to pick up the new session values). Problem is I cant think how to
 accomplish the resetting of the fields to nothing with one click
 
 Code so far(below)
 **********************************
 <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF'];
 ?>">
 <input name="Submit" type="submit"  value="  Clear  ">
 
 <?php
 if(isset($_POST['Submit'])){
 $_SESSION['savedcomm']='';
 $_SESSION['pupilfield']='';
 $_SESSION['gender']='';
 }
 ?>
 
 </form>
 ****************************
 
 Help greatly appreciated
 Ian
 [Back to original message] |