if statement doing one thing at a time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
deadman6
Forum Newbie
Posts: 4
Joined: Wed Sep 14, 2011 1:51 pm

if statement doing one thing at a time

Post 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?
Theramore
Forum Newbie
Posts: 22
Joined: Sun Jun 26, 2011 6:53 am

Re: if statement doing one thing at a time

Post 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
} ?>
Post Reply