I trying to create a shopping cart using SESSION with PDO style connection, but I'm facing error
"Notice: Undefined index: name in" "Notice: Undefined index: price in"
I'm pretty sure that exists in my database table, here is the code
<?php
$stmt = $conn->prepare('SELECT * from tbl_product');
$stmt->execute();
if($stmt->fetchColumn() > 0)
{
while($row = $stmt->fetchAll(PDO::FETCH_ASSOC))
{
?>
<div class="col-md-4">
<form method="post" action="../ppuyakul/cata_main?action=add&id=<?php echo $row["id"]; ?>">
<div style="border:1px solid #333; background-color:#f1f1f1; border-radius:5px; padding:16px;" align="center">
<img src="<?php echo $row["image"]; ?>" class="img-responsive" /><br />
<h4 class="text-info"><?php echo $row["name"] ?></h4>
<h4 class="text-danger">$ <?php echo $row["price"]; ?></h4>
<input type="text" name="quantity" class="form-control" value="1" />
<input type="hidden" name="hidden_name" value="<?php echo $row["name"]; ?>" />
<input type="hidden" name="hidden_price" value="<?php echo $row["price"]; ?>" />
<input type="submit" name="add_to_cart" style="margin-top:5px;" class="btn btn-success" value="Add to Cart" />
</div>
</form>
</div>
<?php
}
Thanks in advance, i really don't know how to solve this issue =(