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 2.7 (score out of 5, no. of ratings: 9)
Comments
Comment by Carley on 2011-07-04
Fralnky I think that's absolutely good stuff.

Comment by gy on 2011-02-11
hi

Comment by sunny on 2011-08-05
dddd

Post a Comment
Name
Email
(optional)
Comment
RatingUnhelpful Helpful
Security Image* (this is just to prevent spam submissions)
Security Image