Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/submit.inc.php
<?php
	//////////////////////////////////////////////////////////
	//	THIS SCRIPT FIGURES OUT WHAT SUBMIT THEY HIT	//
	//	AND THEN SETS A SESSION VARIABLE SO WE KNOW 	//
	//	WHAT BUTTON THEY HIT.				//
	//							//
	//	In order for this to work, we need to include	//
	//	a hidden post for each button.			//
	//							//
	//	C. Carl H Peterson 2005-2007			//
	//////////////////////////////////////////////////////////
if (isset($_POST['submit'])) { // if they hit a submit button
	
			
	if(isset($_POST['LB_STATE'])) {
if ($debug)		echo"LB_STATE is set<br>";
		$LB_STATE=($_POST['LB_STATE']);
		$LB_STATE= __unserialize($LB_STATE);
		
		if (!is_array($LB_STATE)) { 
			echo"<p class=\"error\">Left button states are not returning an array!</p>";
		}else{
			foreach($LB_STATE as $lb_btn=>$lb_state){
				//		unset($lb_status);
				$lb_status["$lb_btn"]="$lb_state";
				//echo"$lb_btn $lb_state<br>";
			}
		}
		
	}
	
	
	if(isset($_POST['buttonID'])) {
		$buttonID = $_POST['buttonID'];
		if($_SESSION['drop'] != $_POST['buttonID']){
			$button_before=$lb_status["$buttonID"];
			if ($debug) echo"<p>button before: $buttonID: $button_before</p>";
			
			if ($lb_status["$buttonID"]=="off") { $lb_status["$buttonID"]="on"; 
			}elseif ($lb_status["$buttonID"]=="on") { $lb_status["$buttonID"]="off"; 
			}else{
				if ($debug) echo"<p>button $buttonID was neither on or off.  Assuming not a left button.</p>";
			}
			
			
			$button_after=$lb_status["$buttonID"];
			if ($debug) echo"<p>button after: $buttonID: $button_after</p>";
			
			
			$_SESSION['button'] = $buttonID;
			unset($_POST['buttonID']);
		}else{  
			$button_before=$lb_status["$buttonID"];
			if ($debug) echo"<p>button before: $buttonID: $button_before</p>";
			if ($lb_status["$buttonID"]=="off") { $lb_status["$buttonID"]="on"; 
			}elseif ($lb_status["$buttonID"]=="on") { $lb_status["$buttonID"]="off"; 
			}else{
				if ($debug) echo"<p>button $buttonID was neither on or off. Assuming not a left button.</p>";
			}
			$button_after=$lb_status["$buttonID"];
			if ($debug) echo"<p>button after: $buttonID: $button_after</p>";
			unset($_SESSION['drop']);
			unset($_POST['buttonID']);
			unset($buttonID);
		}
	}else{
		die('A Submit button was pressed but no buttonID was sent');
	}
	
	
}

	
?>	
Return current item: phpMyPrepaid