subnet_rx Posted August 15, 2007 Share Posted August 15, 2007 I'm pulling values from a database that has spaces in it. I'm using urlencode to create the $_GET variables like this: while ($row = mysql_fetch_assoc($result)) { echo "<li><a href=\"programs.php?c=".$_GET['c']."&d=".urlencode($row['Department'])."\">".$row['Department']."</a></li>"; } When I pull it back out, I'm using this: $d = htmlspecialchars(urldecode($_GET['d'])); Is this the proper way to do this so I get the same exact value? The problem I'm running into is any value with a ampersand (&) in it. Quote Link to comment https://forums.phpfreaks.com/topic/65114-solved-encodedecode-question/ Share on other sites More sharing options...
Orio Posted August 15, 2007 Share Posted August 15, 2007 PHP automatically decodes url variables for you. Orio. Quote Link to comment https://forums.phpfreaks.com/topic/65114-solved-encodedecode-question/#findComment-324965 Share on other sites More sharing options...
subnet_rx Posted August 15, 2007 Author Share Posted August 15, 2007 That was my problem, took out the decode and it works fine, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/65114-solved-encodedecode-question/#findComment-324968 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.