Re: Passing varibles

From: Date: Mon, 05 Aug 2002 05:27:31 +0000
Subject: Re: Passing varibles
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-111142@lists.php.net to get a copy of this message
You also might consider adding escaped quotes about the $player_name. e.g. $player_name="Bob Jones"; <input type=hidden name=player_name value=\"$player_name\"> This insures that both Bob and Jones gets into the player_name variable. Hope this helps. Hugh ----- Original Message ----- From: "Martin Towell" <martin.towell@world.net> To: <jim@jimlong.net>; "php" <php-general@lists.php.net> Sent: Sunday, August 04, 2002 9:57 PM Subject: RE: [PHP] Passing varibles > try this: > > "<td><input type='text' name='the_score' > size='3'><input > type='hidden' name='player_name' > value='$player_name'></td>". > > hidden input fields need both a name and a value.. > > Martin > > > -----Original Message----- > From: Jim Long [mailto:jim@jimlong.net] > Sent: Monday, August 05, 2002 3:34 PM > To: php > Subject: [PHP] Passing varibles > > > 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 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#111142) next »