kevinfwb Posted February 26, 2007 Share Posted February 26, 2007 I have a PHP page that retrieves the contents of a variable from a db using GET. The variables are owners names and often include the & symbol due to more than one owner. When the value is passed GET only reads up to the & symbol and ignores the rest. Is there a clever way to pass the & symbol using GET? Thanks, Kevin Link to comment https://forums.phpfreaks.com/topic/40235-solved-help-passing-the-symbol/ Share on other sites More sharing options...
Orio Posted February 26, 2007 Share Posted February 26, 2007 Look into urldecode(). Orio. Link to comment https://forums.phpfreaks.com/topic/40235-solved-help-passing-the-symbol/#findComment-194669 Share on other sites More sharing options...
dymon Posted February 26, 2007 Share Posted February 26, 2007 Hi, in the URL the symbol & means another variable with a value, so I think you should just use another separator. If I understood right this should solve the problem. In any case if you need the owners apart you can just make a parsing of the string you get using $_GET ( explode () - is a good variant ). Regards, Dymon Link to comment https://forums.phpfreaks.com/topic/40235-solved-help-passing-the-symbol/#findComment-194676 Share on other sites More sharing options...
kevinfwb Posted February 26, 2007 Author Share Posted February 26, 2007 I appreciate the replies. I can not change the separator because that is how it is stored in the database. The owners are treated as one unit. IE. "Jim & Jane Smith" -Kevin Link to comment https://forums.phpfreaks.com/topic/40235-solved-help-passing-the-symbol/#findComment-194688 Share on other sites More sharing options...
dymon Posted February 26, 2007 Share Posted February 26, 2007 In this case I don't think it will be possible to use $_GET, try to use $_SERVER["QUERY_STRING"], and extract from this string what you need. Hope it helps. Dymon Link to comment https://forums.phpfreaks.com/topic/40235-solved-help-passing-the-symbol/#findComment-194705 Share on other sites More sharing options...
shoz Posted February 26, 2007 Share Posted February 26, 2007 Orio pointed out urldecode and from that you should have been able to find your solution. You should specifcally be using urlencode when putting the field's value in the url string. eg: <?php $str = "Jim & Jane Smith"; $url = 'http://www.com/page.php?str='.urlencode($str); print $url; ?> The correct value of "Jim & Jane Smith" will be in the resulting $_GET array on page.php Link to comment https://forums.phpfreaks.com/topic/40235-solved-help-passing-the-symbol/#findComment-194718 Share on other sites More sharing options...
kevinfwb Posted February 26, 2007 Author Share Posted February 26, 2007 Works like a charm.. I was looking too much into it. Thanks for your help! -Kevin Link to comment https://forums.phpfreaks.com/topic/40235-solved-help-passing-the-symbol/#findComment-194728 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.