Hey guys im not sure how this isset code is working and what each if statement is testing.
a clear explanation would help.
cheers
****ViewProductDetails.php****
Code:
<?php
session_start();
?>
<html>
<body>
<?php
if (isset($_POST['submit']))
{
if($_SESSION['item']==$_POST['h1'])
{
$_SESSION['qty'] = $_SESSION['qty'] + 1;
}
else
{
$_SESSION['item'] = $_POST['h1'];
$_SESSION['price']= $_POST['h2'];
}
$_SESSION['itemname'][$_SESSION['item']] = $_SESSION['item'];
$_SESSION['itemqty'][$_SESSION['item']] = $_SESSION['qty'];
$_SESSION['itemprice'][$_SESSION['item']] = $_SESSION['price'];
}
?>
<table>
<tr>
<td>
<img src="eric.jpg"/>
</td>
<td>This product is on clearance. New stock needs to come in and all the old stock needs to go. Hurry till offers end!!</td></tr>
<tr><td><form action="erricsson.php" method="post"><input type="submit"
name="submit" value="Add to cart"/><input type="hidden" name="h1"
value="k508i" /><input type="hidden" name="h2" value="400"/></form> </td></tr>
</table>
<a href="cart.php">View your cart</a>
</body>
</html>
musicmancanora4 0 Light Poster
cwarn23 387 Occupation: Genius Team Colleague Featured Poster
musicmancanora4 0 Light Poster
vibhaJ 126 Master Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.