syntax error
Posted: Mon Sep 21, 2009 9:22 pm
<input name="prodId" type="hidden" value="<? echo $['idRoute']?>"> </td> it says that it is a syntax error but im not sure how it is?
Hey guys im trying to code up some product descriptions reading through a text file at i get an error on this line
your reply would be greatly appreciated
Hey guys im trying to code up some product descriptions reading through a text file at i get an error on this line
your reply would be greatly appreciated
Code: Select all
<?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>
</select>
<input type="submit" name="submit" id="submit" value="Show products"/>
<input name="prodId" type="hidden" value="<? echo $['idRoute']?>"> </td> *****Im not sure but does this error?
</form>
<!-- if user presses show products of phones, navigations etc
read declare a variable called $file and associate it with products.txt -->
<?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'); // open file for reading instead of using a database connection you read straight out of a text file
//$counter=0;
while(!feof($fp)) //while there is still data in the file keep reading until end of line
{
$data = fgets($fp);
echo $data;
$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>