Mega Code Archive

 
Categories / Php / HTML
 

Checking for magic quotes

<?php if (is_null($_GET["search"])) {     echo '<form method="'.htmlentities($_SERVER["PHP_SELF"]).'" method="GET">';     echo '    <label>';     echo '       Search:';     echo '       <input type="text" name="search" id="search" />';     echo '    </label>';     echo '    <input type="submit" value="Go!" />';     echo '</form>';     } else {     $search = $_GET["search"];     if (!get_magic_quotes_gpc(  )) {         $search = htmlentities($search);     }     if ($search != NULL ){         echo "The search string is: <strong>$search</strong>.";     } } ?>