header
 
     
 
pixel
pixel pixel

Encoding form variables in a URL

If you're putting form variables in a URL, you can get into strife when the user enters spaces or other non-alphanumeric characters in the form. The way to convert their data to a URL compliant format is as follows:
<?php
echo '<a href="webpage.php?formvalue='.htmlentities(urlencode($formvalue)).'">';
?>

Unhelpful Helpful Rating 5.0 (score out of 5, no. of ratings: 1)
Post a Comment
Name
Email
(optional)
Comment
RatingUnhelpful Helpful
Security Image* (this is just to prevent spam submissions)
Security Image