PHP Usage

PHP Usage

Starting your php code

Always start your PHP code with <?php rather than <? as it’s less work for your parser. This is good practice.

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.Here is the way to convert their data to a URL compliant format:

<?php
echo ‘<a href=”scriptname.php?formvalue=’.htmlentities(urlencode($formvalue)).’” mce_href=”scriptname.php?formvalue=’.htmlentities(urlencode($formvalue)).’”>’;
?>

Leave a Reply


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.