Hey guys i have the following code below for a shopping cart
just wondering what this hidden input text would be used for and the echo at the end of it.
I know it reads from a text file with : as delimeters and it as an ID for each product.
If you could assist me that would be great
<input name="prodId" type="hidden" value="<? echo $['idRoute']?>"></td>
<?php
session_start();
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<?php
?>
<body>
<form id="fSample" name="fSample" method="post" action="products.php">
<select name="product">
<option value="mobiles">Mobiles</option>
<option value="radios">Radios</option>
<option value="navigators">Navigators</option>
<option value="guitars">Guitars</option>
</select>
<input type="submit" name="submit" id="submit" value="Show products">
<input name="prodId" type="hidden" value="<? echo $['idRoute']?>"></td>
</form>
<?php
if (isset($_POST['submit']))
{
echo "<br/><br/>";
echo "<table border='1'>";
echo "<tr><th>Name</th><th>Description</th><th>Price</th></tr>";
$file = "products.txt";
$fp = fopen($file, 'r');
//$counter=0;
while(!feof($fp))
{
$data = fgets($fp);
$chunk = explode(":",$data);
if($_POST['product']==$chunk[0])
{
echo "<tr><td>$chunk[1]</td><td>$chunk[2]</td><td>$chunk[3]</td><td><a href='$chunk[4]'><input type='button' value='View details'/></a></td></tr>";
}
//$counter = $counter + 1;
//echo $data;
}
fclose($fp);
echo "</table>";
}
?>
</body>
</html>