Jump to content

Transferring data to another page


cliftonbazaar

Recommended Posts

I have the following code

while($player = mysql_fetch_array($players)) { #Lets loop through all the players
echo "<BR><input type=submit onclick=this.form.action='points.php?points=".$_GET['points']."&player=".$player['playerID']."&playerName=".$player['name']."' value='".$player['name']."'>";
}

but the problem is that $player['name'] is always two words and it doesn't work.  So I have removed '&playerName=".$player['name']."' but now don't know how to transfer that info.

 

Is there a way of having the player name in the header or another way of sending this data to the next page?  Another way of doing it is to check for the players name via there playerID number but this involves another call to the database which I am trying to avoid.

Link to comment
https://forums.phpfreaks.com/topic/234568-transferring-data-to-another-page/
Share on other sites

Use url_encode and url_decode to pass information (such as strings with spaces and symbols) in the query string.

 

So you would have:

 

'&playerName=" . url_encode($player['name']) . "'

 

and then on your points.php page, access the player name with

 

$name = url_decode($_GET['playerName']);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.