glassfish Posted October 17, 2014 Share Posted October 17, 2014 The Script: <?php echo "<h1>The Hashtag: </h1>"; echo $_GET['hashtag']; ?> An example for the URL on localhost: /search.php?hashtag=#xbox If I am not using the number sign, then the word "xbox" does get printed on screen, if I do use the number sign then the hashtag "#xbox" does not get printed on screen. Any suggestions on how to do this? Link to comment https://forums.phpfreaks.com/topic/291883-how-to-user-the-number-sign-for-the-get-method/ Share on other sites More sharing options...
davidannis Posted October 17, 2014 Share Posted October 17, 2014 You need to encode the # ?hashtag=%23xbox You can find an explanation here or Google it. Link to comment https://forums.phpfreaks.com/topic/291883-how-to-user-the-number-sign-for-the-get-method/#findComment-1493995 Share on other sites More sharing options...
glassfish Posted October 17, 2014 Author Share Posted October 17, 2014 Thanks for the answer. This is how I have gotten it to work: <?php $string = "#xbox"; echo "<a href='search.php?hashtag=" . urlencode($string) . "'>#xbox</a>"; echo "<h1>The Hashtag: </h1>"; if(isset($_GET['hashtag'])){ echo $_GET['hashtag']; } ?> Link to comment https://forums.phpfreaks.com/topic/291883-how-to-user-the-number-sign-for-the-get-method/#findComment-1493998 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.