Jump to content
  • Advertisement
Sign in to follow this  
Nanven

[web] Help - PHP

This topic is 5203 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to make links dynamically where when you click them they reload the page passing an argument. Ala:
for($rankIndex = 1; $rankIndex <= 5; $rankIndex++) {
    echo($ranks[$rankIndex] . "<br>");
    while($memberNames[$rankIndex][$index] != "" && $memberNames[$rankIndex][$index] != "_DEFAULT") {
      $name = $memberNames[$rankIndex][$index];
      echo("<a href=$memberPage?profile=$name>$name</a><br>");
      $index++;
    }
    echo("<br>");
  }


The problem is $memberNames[$rankIndex][$index] has more than one word. Like "Joe Schmoe" and it is only setting ?profile to the first part.. ala ?profile=Joe instead of ?profile=Joe%20Schmoe. How do I fix that? I kinda know whats wrong and have tried doing ?profile=\"$name\" but that just does ?profile="Joe. The $name as the link text works just fine, displaying the whole string. Any help is appreciated.

Share this post


Link to post
Share on other sites
Advertisement
You have to urlencode stuff in query strings in links.

But you don't have to urldecode it when it comes back in, it is automatically decoded by PHP, so

$_GET['profile']

Will contain it already decoded.

Mark

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!