Page 1 of 1

if statement doing one thing at a time

Posted: Wed Sep 14, 2011 7:45 pm
by deadman6
When i do this

Code: Select all


<?php if($_POST[reset]) {
unset($_SESSION[counter]);
unset($_SESSION[display]); } ?>

with a submit button with the name reset...
when i do it this way it resets the counter on the first click then display on the second... is there a way to do it with one click?

Re: if statement doing one thing at a time

Posted: Thu Sep 15, 2011 7:05 am
by Theramore
Try this:

Code: Select all

<?php 
if($_POST[reset]) {
unset($_SESSION[counter]);
unset($_SESSION[display]); 
?>
<script type='text/javascript'>
window.location = 'link to the page to refresh';
</script>
<?php
} ?>