Passing varibles
| From: | Jim Long | Date: | Mon, 05 Aug 2002 05:33:50 +0000 |
| Subject: | Passing varibles | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-111131@lists.php.net to get a copy of this message | ||
Hi,
I'm sorry.. I don't really have any idea what I'm doing, but I almost
got this thing working. If someone could help, I'd deeply appreciate it.
I need to get these variables to the next script (edit_scores.php3):
$the_Score, $player_name
so I can update the field (s1) WHERE the last_name is $player_name
I'm pretty close with this:------------
// Display the scores
while ( $row = mysql_fetch_array($result) ) {
echo("<table border='0' cellpadding='3'
cellspacing='0'>" .
"<tr>".
"<td>". $row["last_name"]. "</td>" .
"<td>". $row["first_name"] ."</td>".
"<td></td><td></td><td></td>".
"</tr>".
"<tr>".
"<td>".$row["s1"] ."</td>".
"<td>"."<form action = edit_score.php3>". "</td>".
"<td>"."<input type='text' name='the_score'
size='3'>"."<input
type='hidden' name='$player_name'>"."</td>".
"<td>"."<input type='submit' name='s1'
value='edit'>"."</td>".
"<td>"."</form>"."</td>".
"</tr>".
etc..etc.. more scores -------------------------
$the_score is passed ok... but how do I include passing the
$player_name?
The result from above in the url is:
cpa_golf/edit_score.php3?the_score=23&nichols=++&s1=edit
"nichols" is "$player_name" but is will not echo in the script.
I need to use "s1" (it is the name of the field I want to update where
the player is "nichols"
Code I use in edit_score.php3 is:-----------------(this ain't quite
right yet)
echo("$players_name". ", ". "$the_score");
//to check if the varibles are being passed to the script
//update
$sql = "update scores set
s1 = '$the_score'
where last_name = '$player_name'";
if (mysql_query($sql)) {
echo("<P>Your score has been added.</P>");
} else {
echo("<P>Error adding submitted score: " .
mysql_error() . "</P>");
}
---------------
Sorry.. I don't do this often.
Again, I really would appreciate some help.
Jim Long