tjverge Posted February 1, 2011 Share Posted February 1, 2011 <form action="main.php?id=test.php" method="post"> <input name="name" type="text" /> <input name="submit" type="submit" value="Look Up" /> </form> <?php if(isset($_POST['submit'])) { $today = date("Y-m-d"); $pname = rawurlencode($_POST['name']); $xml_feed_url = 'http://api.eve-online.com/eve/CharacterID.xml.aspx?names='.$pname.''; The above works perfect until the user enters a character like ' to the box, how do I get it to pass the ' into the address? Thank you Link to comment https://forums.phpfreaks.com/topic/226358-variable-to-url-with-special-character/ Share on other sites More sharing options...
AbraCadaver Posted February 1, 2011 Share Posted February 1, 2011 If: echo $pname; Gives: %5C%27 instead of %27, then magic_quotes_gpc is enabled and you need: $pname = rawurlencode(stripslashes($_POST['name'])); Link to comment https://forums.phpfreaks.com/topic/226358-variable-to-url-with-special-character/#findComment-1168371 Share on other sites More sharing options...
tjverge Posted February 1, 2011 Author Share Posted February 1, 2011 Thanks it fixed it Link to comment https://forums.phpfreaks.com/topic/226358-variable-to-url-with-special-character/#findComment-1168373 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.