Jump to content

matto

Members
  • Posts

    230
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

matto's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I think you mis-understand how sessions work. Every new visitor to this script has the session variable $_SESSION['Guest'] set to 1 and $_SESSION['Guest'] is only incremented when the script is executed by someone who has already visited the page <?php session_start(); if(isset($_SESSION['Guest'])) { //This code is only executed by the already visited guest $_SESSION['Guest']=$_SESSION['Guest']+1; echo "\$_SESSION['Guest'] now equals: " . $_SESSION['Guest']; } else { //every new visitor gets the $_SESSION['Guest'] = 1 $_SESSION['Guest']=1; } ?> It would be better to keep track of the number of guests using a database...
  2. Only have the code execute when the submit button on the form is pressed. eg: if(isset($_POST['submit')) { //start executing code.... }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.