February 20, 201511 yr i'm display product information from file by there name So in some products name included with special characters specially ' & 'etc.. so for example : here is the url mysite.com/index.php?s=html & php so its showing html only in echo i'm using $_REQUEST['s']; for getting url here is the code for encode i used <?php $text = $_REQUEST['s']; echo rawurlencode($text); ?> but its not working with $_request its displaying only Html but when i used simple text its work eg.. <?php $text = ('html & php'); echo rawurlencode($text); ?> so now its work and echo came html%20%26%20php and thats what i want please help me to solve that $_REQUEST thing what should i do with that thanks in advanced
February 20, 201511 yr it is because you are using & in the url this acts as a seperator, try using %26 inplace of the & i.e. mysite.com/index.php?s=html %26 php
February 20, 201511 yr Author it is because you are using & in the url this acts as a seperator, try using %26 inplace of the & i.e. mysite.com/index.php?s=html %26 php i cannot change the url because i'm getting link data from xml file feed from an online server product name html & php in xml so its must be xml & php for showing this product other information eg. details and price .... so i cannot change the name or change the url ... is there any other solution ??
February 20, 201511 yr What's probably happening is: $_GET['s'] = html $_GET['php'] = "" If you want to grab if it's HTML and php and you definitely can't change the URL then your going to have to hack it around and do something like: If(isset($_GET['php']) && $_GET['s'] == "html") { $s = "html&php"; } Then use $s and rawurlencode it. Good luck!
Create an account or sign in to comment