| 
 Posted by Ian Davies on 06/21/06 20:19 
thanks for your reply tommy 
 
unfortunately your suggestion doesnt work (also requiring two click) 
I think because of the following line 
 
if(isset($_POST['Submit'])){ 
 
i suspect the problem with your solution is that $_POST['Submit'] isnt set 
until it is clicked (i think). 
i need the isset function to eliminate the problem of the sessions being 
changed during other events that occur on this page. 
 
Ian 
 
"Tommy Gildseth" <gildseth@start.no> wrote in message 
news:129j9l5m4jecr91@corp.supernews.com... 
> 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/
 
  
Navigation:
[Reply to this message] 
 |