I have a PHP page that simply gets links and descriptions from a mySQL database like this:
<?php
$usr = "user";
$pwd = "password";
$db = "database";
$host = "localhost";
$cid = mysql_connect($host,$usr,$pwd);
if (!$cid) { echo("ERROR: " . mysql_error() . "\n"); }
?>
<?php
$category = "1";
$SQL = " SELECT * FROM links";
$SQL = $SQL . " WHERE category = '$category'";
$retid = mysql_db_query($db, $SQL, $cid);
if (!$retid) { echo( mysql_error()); }
print ("<center><table cellpadding=2 cellspacing=0 width=100% border=1>\n");
while ($row = mysql_fetch_array($retid)) {
$siteurl = $row["siteurl"];
$sitename = $row["sitename"];
$description = $row["description"];
print ("<tr><td width=20% valign=top><b><font face=Arial size=2><A HREF='$siteurl' target=_blank>$sitename</A></font></b></td>");
print ("<td width=80% valign=top><font face=Arial size=2>$description</font></td></tr>\n");
}
print("</table></center>");
?>
So far so good eh? I wrote a ratings script that works pretty good. The first thing I have to define is $item_id. I think when the dynamic table prints I can do a simple <td> with the following:
<? $id = $row["siteurl"] ?>
<form>
<input type=hidden name=item_id value=$id>
<other form code to submit>
</form>
How do I write the hidden variable in valid PHP (I'm sure I have part of the syntax wrong) so every row picks the right variable (siteurl) in the array?