All pastes #566293 Raw Edit

sessions

public php v1 · immutable
·published 2007-06-14 12:02 UTC
rendered paste body
page 1<?phpsession_start(); //first pagerequire_once('Connect/connection.php');// Create an empty array to hold the error messages.$damnError = array();//Only validate if the Submit button was clicked.if (!empty($_POST['Submit'])) {    // Each time there's an error, add an error message to the error array    // using the field name as the key.    if ($_POST['whichSite']=='')		$damnError['whichSite'] = 'Please select which site the product is from.';	if ($_POST['title']=='')        $damnError['title'] = 'Please select Title.';}		if (count($damnError) == 0) {        // If the error array is empty, there were no errors.		if (isset($_POST['Submit'])) {								$whichSite = $_POST['whichSite'];			$title = $_POST['title'];			            $_SESSION['whichSite'] = $whichSite;			$_SESSION['title'] = $title;		}	}	else	{		error msg blah blah;	}}?>last page<?phpsession_start();//last pageif ($_SESSION['whichSite'] == ''){	header("location: page1.php");}while(list($key, $value) = each($_GET)){echo "$key = $value(br)";}require_once('Connect/connection.php'); // Create an empty array to hold the error messages.$damnError = array();//Only validate if the Submit button was clicked.if (!empty($_POST['submit'])) {	// Each time there's an error, add an error message to the error array	// using the field name as the key.	if ($_POST['decDate']=='')	{		$arrErrors['decDate'] = 'You must date this form before proceeding.';	}		if (count($damnError) == 0) 	{		// If the error array is empty, there were no errors.		if (isset($_POST['submit'])) 		{			$decDate = $_POST['decDate'];			$_SESSION['decDate'] = $decDate;									// Mysql database connection, also database selection			$cxn = ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);						$sql = "insert into table (whichSite, title, decDate) values ('". $_SESSION['bikeWhich'] ."', '". $_SESSION['title'] ."', '". $_SESSION['decDate'] ."')";			$result = mysql_query($sql);			//echo $sql;			//exit;						// send email here						header("Location: thanks.php");		}	}	else	{		error msg blah blah;	}}?>