Hello all,
I'm pretty new to PHP & SQL. I am having some trouble with a web voting page I'm creating. I have a PHP loop which is displaying data from SQL table A. Beside it, a small text box linked to SQL table B to allow users assign numeric preferences. I need the preferences of users to be UPDATE'd to the database. Here is what I've got:
<?php
$Full = $_POST['Full'];
$rows = "SELECT COUNT (*) FROM candidate";
$query = mysql_query("SELECT LastName, FirstName, Party, Description FROM candidate") or die(mysql_error());
$link = "<input type='int' name='Full' size='7'>";
$sql = "UPDATE prstv SET FULL = (FULL + '$link')";
if (@mysql_query($sql)){
"INSERT into prstv(vote) value (1)";
}else{
echo '<p> Error Adding Vote Values:'.mysql_error().'</p>';
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Candidate Voting Page</title>
</head>
<body>
<form action="<?php echo(htmlentities($_SERVER['PHP_SELF']));?>"method="Post">
<?php
echo "<table border='1'>";
echo "<tr><th>Last Name</th><th>First Name</th><th>Party</th><th>Description</th><th>Cast Vote</th>";
while($row = mysql_fetch_array($query))
{
echo "<tr><td>";
echo $row['LastName'];
echo "</td><td>";
echo $row['FirstName'];
echo "</td><td>";
echo $row["Party"];
echo "</td><td>";
echo $row["Description"];
echo "</td><td>";
echo $link;
//$preference;
}
echo "</table>";
?>
<input type='submit' value='Submit'>
</form>
</body>
</html>
The highlighted(red) is the main issue. I'd appreciate any help offered.
Exploded