Page 1 of 1

PHP - Form - Help - Probably Simple

Posted: Fri Jul 30, 2010 3:24 pm
by CGoal
Im hoping this is simple for someone. I am not the best developer. But trying to learn on my own.

I have a simple database that will be mainting scores from a game.
Upon the completion of the game, i want to go to an admin screen that i am making and jsut update teh score, rather than logging into the database.

So, my page DISPLAY_SCHED_EDIT.PHP will return my records from a database in a form that is should be ready to update.

Code: Select all

<body>
<form action="update_sched.php" method="post">
<table class="tableRoster" align="center" border='0' width="800" cellpadding='0' cellspacing='0'>
<tr>
	<th width="30%" align="left">opponent</th>
	<th width="10%" align="left">sbp</th>
	<th width="10%" align="left">opp</th>
	<th width="10%" align="left">result</th>
	<th width="40%" align="right">edit</th>
</tr>
<!--  **** color variables and initial row count ***-->
<?php
$color1 = "#dddddd";
$color2 = "#ffffff";
$row_count = "0";

$NodeTitles = mysql_query("SELECT SCHED_OPP, SCHED_LOC, SCHED_SBP, SCHED_AWAY, SCHED_RESULT FROM PREP_SCHED WHERE SCHED_ID = $e_id ORDER BY SCHED_DATE ASC") or die (mysql_error());
while ($row = mysql_fetch_assoc($NodeTitles)) {

$row_color = ($row_count % 2) ? $color1 : $color2;
?>
<tr>
<td width="30%" bgcolor="<?php echo $row_color ?>"><b>
<?php echo $row["SCHED_OPP"];?></b></td>
<td width="10%" bgcolor="<?php echo $row_color ?>">
<input type="text" name="uSCHED_SBP" size="5" value=<?php echo $row["SCHED_SBP"];?>></td>
<td width="10%" bgcolor="<?php echo $row_color ?>">
<input type="text" name="uSCHED_AWAY" size="5" value=<?php echo $row["SCHED_AWAY"];?>></td>
<td width="10%" bgcolor="<?php echo $row_color ?>">
<input type="text" name="uSCHED_RESULT" size="5" value=<?php echo $row["SCHED_RESULT"];?>></td>

<td align="right" width="40%" bgcolor="<?php echo $row_color ?>"><a href="update_sched.php">submit change</a></td>
</tr>
</form>
<?php
    $row_count++;
}
 ?>
</table>
Then at this point, i am just trying to get a simple display on UPDATE_SCHED.php. Eventually i will write teh UPDATE script here, but for now, i am jsut trying to get the form data to ECHO back

Code: Select all

<?php
$uSCHED_SBP = $_POST["uSCHED_SBP"];
echo "Hello, ".$uSCHED_SBP ;
?>
Any help is appreciated. I have been searching this forum and on the internet.

Re: PHP - Form - Help - Probably Simple

Posted: Sun Aug 01, 2010 3:04 am
by JakeJ
Try this:
$NodeTitles = mysql_query("SELECT SCHED_OPP, SCHED_LOC, SCHED_SBP, SCHED_AWAY, SCHED_RESULT FROM PREP_SCHED WHERE SCHED_ID = '$e_id' ORDER BY SCHED_DATE ASC") or die (mysql_error());

Notice the single quotes around '$e_id'

Re: PHP - Form - Help - Probably Simple

Posted: Sun Aug 01, 2010 1:49 pm
by CGoal
Thanks for the reply. I got my answer. It had nothing to do with PHP. I messed up on my form tag. I didnt have the submit button correctly