<?php
session_start();
if (!isset($_SESSION['FirstName'])) {
	exit;
}

include ('includes/db1config.php');
include ('../includes/mysql_connect.php');

if (isset($_POST['choiceId']) && $_POST['choiceId']!='') {

	$choiceId  = $_POST['choiceId'];
	if (isset($_POST['itemprice']) && $_POST['itemprice']!='') {

		$itemprice = $_POST['itemprice'];
		$sql = "UPDATE options SET price = $itemprice WHERE itemkey = $choiceId ";
		mysql_query($sql) or die(mysql_error());
	}
	$sql = "select price from options WHERE itemkey = $choiceId ";
	$result = mysql_query($sql) or die(mysql_error());
	while ($row = mysql_fetch_assoc($result)) {
	        $price      = $row['price'];
	}
	$arrayprice = array();
	$arrayprice = array(
	        'price'    => $price,
	        'choiceId' => $_POST['choiceId']
	);
	echo json_encode($arrayprice);
}



?>