Posted by Tommy Gildseth on 06/21/06 20:06
Ian Davies wrote:
> Hello
> I 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
>
>
Simply rearange the order of the form, and the resetting of the session
variables, so that the resetting of session variables comes before the
form in the code?
--
Tommy Gildseth
http://design.twobarks.com/
[Back to original message]
|