I have a html page (product.html) and php page (session.php)…
i need to pass values from product page to session page… for session creation…
everything works fine…But i need to set session values again for the changes of new qty.
this is my code…
Product.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15%"> </td>
<td width="15%">Items</td>
<td width="70%"> </td>
</tr>
<tr>
<td> </td>
<td><a href="session.php?itemID=1000139&qty=1">1000139</a></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a href="session.php?itemID=1000140&qty=3">1000140</a></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a href="session.php?itemID=1000141&qty=2">1000141</a></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
Session.php
<?php
$itemID=$_GET['itemID'];
$qty=$_GET['qty'];
if(!isset($_SESSION['cart'])){
session_start();
session_register('cart');
}
$_SESSION['cart'][$itemID]=$qty;
if(isset($_POST['hd']) && $_POST['hd']=='form1'){
foreach($_POST as $key=>$val){
echo $key."=======>".$val."<br>";
$_SESSION['cart'][$itemID]=$val;
}
$location="<script>window.location='session.php'</script>";
echo $location;
unset($location);
//header("location:session.php");
}
?>
...........
...........
<?php
foreach($_SESSION['cart'] as $key=>$val){
//echo $key."=======>".$val."<br>";
?>
<tr>
<td> </td>
<td><?php echo $key?></td>
<td><input name="<?php echo $key?>" type="text" size="5" value="<?php echo $val?>"/></td>
<td>10</td>
<td> </td>
</tr>
<?php
}
?>
.................
.................
<td><input type="submit" name="Submit" value="Calculate" />
<input name="hd" type="hidden" id="hd" value="form1" /></td>
the problem is… when i click on Calculate button,
the text box value changes as ‘form1’…
Can anyone help me to figure out this problem???Pls