I'm having problems with sessions when using PHP 4.3.2 with Apache 1.3.24.
In my code, a logged in user can create new events.
Once they've entered all the information into a form, they can click either Submit or Next. If they click Submit, the event will be created in the database, and the form redisplayed with a success message. If they click Next, the event will be created in the database, and the next form will be displayed.
The problem I'm having is when the user clicks Submit, then Next. In my code, the Next button checks to see if the eventID has been set in the session, and if not it will create the event and move on. If the eventID is set, then it just advances the page. However, eventID is not being set, so the event is being created twice. Below is a sample of my code:
// event_admin_form.php
session_start ()
...
_process_event_details_page ($buttonClicked, $action)
...
// Function definition within the same file
function _process_event_details_page ($buttonClicked, $action)
{
// Check form for errors
switch ($buttonClicked)
{
case 'Submit':
// Create the event
$_SESSION['eventID'] = $eventID;
// Redisplay the page
break;
case 'Next':
if (isset ($_SESSION['eventID']) == false)
{
// Create the event
$_SESSION['eventID'] = $eventID;
}
// Display the next page
break;
} // end switch
} // end function