The $cat value, is parsing thru the url
like : http://www.mysite.com/index.php?cat=newbook
<?
echo("
<IMG SRC=http://www.mysite.com/images/head-$cat-submit.gif width=464 height=92>
");
$db = mysql_connect("localhost", "myuser","mypass");
mysql_select_db("mydatabase",$db);
if ($submit) {
if ($id) {
} else {
// update the restarutant add with this review
$cari_result = mysql_query("SELECT * FROM $cat WHERE rest_id='$rest_id'",$db);
while ($cari_row = mysql_fetch_row($cari_result)) {
$tot_star = $star + $cari_row[15];
$tot_comment = 1 + $cari_row[16];
}
$add_sql = "UPDATE $cat SET tot_star=$tot_star,tot_comment=$tot_comment WHERE rest_id=$rest_id";
// update the restarutant add with this review
$lookin = "$cat";
$lookin .= "_comments";
$sql = "INSERT INTO $lookin (title,name,star,comments,rest_id) VALUES ('$title','$name','$star','$comments','$rest_id')";
}
$result = mysql_query($add_sql);
$result = mysql_query($sql);
echo "<CENTER><BR><BR><BR><BR><BR><FONT FACE=VERDANA SIZE=-2><B>Thank you ";
} elseif ($delete) {
} else {
if (!$rest_id) {
$result = mysql_query("SELECT * FROM $cat",$db);
while ($myrow = mysql_fetch_array($result)) {
}
}
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<?php
if ($rest_id) {
?>
<input type=hidden name="rest_id" value="<?php echo $rest_id ?>">
<?php
}
?>
<TABLE>
<TR>
<TD>
<FONT FACE=VERDANA SIZE=2><B>
Write your own review for this list<br>
<FONT FACE=VERDANA SIZE=-2 COLOR=#666666>review guidelines</FONT>
</TD>
</TR>
<TR>
<TD>
<FONT FACE=VERDANA SIZE=-2 COLOR=#666666><B>
Title for your review<BR>
<input type="text" name="title" value="<?php echo $title ?>" CLASS=nicefield SIZE=60>
</TD>
</TR>
<TR>
<TD>
<FONT FACE=VERDANA SIZE=-2 COLOR=#666666><B>
5 stars being the best - 1 stars being the worst, how would you rate<BR>
<select name="star" CLASS=nicefield>
<option value="5">5 Stars
<option value="4">4 Stars
<option value="3">3 Stars
<option value="2">2 Stars
<option value="1">1 Stars
</select>
</TD>
</TR>
<TR>
<TD>
<FONT FACE=VERDANA SIZE=-2 COLOR=#666666><B>
Type your review (maximum length is 200 words)<BR>
<textarea name="comments" rows=8 cols=62 maxlength=200 class=nicefield value="<?php echo $review ?>"></textarea>
</TD>
</TR>
<TR>
<TD>
<FONT FACE=VERDANA SIZE=-2 COLOR=#666666><B>
Your name<BR>
<input type="text" name="name" value="anonymous" CLASS=nicefield SIZE=40>
</TD>
</TR>
</TABLE>
<input type="Submit" name="submit" value="Submit Review">
</form></B><FONT FACE=VERDANA SIZE=-2>
<?php
}
?>