How To Protect Special Characters In Query String

How To Protect Special Characters In Query String


  • 16 Feb, 2012

    If you want to include special characters like spaces in the query string, you need to protect them by applying the urlencode() translation function. The script below shows how to use urlencode():<?phpprint("<html>");print("<p>Please click the links below"." to submit comments about GlobalGuideLine.com:</p>");$comment = 'I want to say: "It's a good site! :->"';$comment = urlencode($comment);print("<p>"."<a href="processing_forms.php?name=Guest&comment=$comment">"."It's an excellent site!</a></p>");$comment = 'This visitor said: "It's an average site! :-("';$comment = urlencode($comment);print("<p>".'<a href="processing_forms.php?'.$comment.'">'."It's an average site.</a></p>");print("</html>");?>

    Comments Received:
    Please give your suggestions and feedback:

2009-2016 downloadmela.com. All rights reserved.