cliftonbazaar Posted April 24, 2011 Share Posted April 24, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/234568-transferring-data-to-another-page/ Share on other sites More sharing options...
lastkarrde Posted April 24, 2011 Share Posted April 24, 2011 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']); Quote Link to comment https://forums.phpfreaks.com/topic/234568-transferring-data-to-another-page/#findComment-1205476 Share on other sites More sharing options...
cliftonbazaar Posted April 24, 2011 Author Share Posted April 24, 2011 urlencode did the trick, thanks for that Quote Link to comment https://forums.phpfreaks.com/topic/234568-transferring-data-to-another-page/#findComment-1205478 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.