I am having some issues getting some code to work. What is supposed to happen is that I pull the record to be edited (Same Record everytime only 1 record posted), edit it, and resubmit it. This is to rapidly update scores for live streaming sporting events.
What basically happens is it pulls the record and allows edit with no problems. After you submit it, the screen never returns and the database is not updated...
Here is the code:
ScoreUpdate.php
<html>
<Title>Score Update</Title>
<BODY>
<CENTER><H1>Score Update</H1></CENTER>
<table cellpadding="0" cellspacing="0" width="400">
<form method="POST" action="ScoreInsert.php">
<CENTER><H1>Score Update</H1></CENTER>
<CENTER>
<tr>
<td width="50%">
Visitor Team
</td>
<td width="50%">
<input type="text" name="Vteam" size="20">
</td>
<td width="50%">
Score
</td>
<td width="50%">
<input type="text" name="Vscore" size="2">
</td>
</tr>
<td width="50%">
Visitor Team
</td>
<td width="50%">
<input type="text" name="Hteam" size="20">
</td>
<td width="50%">
Score
</td>
<td width="50%">
<input type="text" name="Hscore" size="2">
</td>
</tr>
<td width="50%">
Period
</td>
<td width="50%">
<input type="text" name="Period" size="20">
</td>
<td width="50%">
ID
</td>
<td width="50%">
<input type="text" name="id" size="1">
</td>
</tr>
<tr>
<td width="50%">
</td>
<td width="50%">
<input type="submit" value="Update Score" name="btnSubmit">
</td>
</tr>
</table>
</form>
</BODY>
</html>
ScoreInsert.php
<?php
echo "Code Started<br>" ;
$id = $POST['ID'];
$Vteam = $POST['Vteam'];
$Vscore = $POST['Vscore'];
$Hteam = $POST['Hteam'];
$Hscore = $POST['Hscore'];
$Period = $POST['Period'];
if (!isset $POST["$Vteam"]) && !isset $POST["$Vscore"]) && !isset $POST["$Hteam"]) && !isset $POST["$Hscore"]) && !isset $_POST["$Period"])) {
$loc = "Error.php"?e=3;
header("Location: " . $loc);
exit(1);
}
echo "Code Passed If<br>";
$dbLink = mysql_connect("localhost", "xxxx", "xxxx") or die("could not connect to database");
echo "Code Passed dbLink<br>";
$result = mysql_select_db("LiveScore") or die("could not select to database");
echo "Code Passed select_db LiveScore<br>";
$sql = "update score set VisitorTeam = '$Vteam', VisitorScore = '$Vscore', $HomeTeam = '$Hteam', HomeScore = '$Hscore', Period = '$Period' where ID = '$id'";
echo "Code Passed sql update score;<br>";
$result = mysql_close($dbLink) or die("query failed");
echo "Code Passed result = mysql_close <br>" ;
$loc = "http://sec.lavaa.net/livescore/ScoreUpdate.php";
header("Location: " . $loc);
echo "Code Passed LOC <br>" ;
exit;
?>
Any ideas on this would be appreaciated.