Learning PHP and MySQL

Example 14-12 Checking for magic quotes

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

Posted by on 09/25 at 03:18 PM

Next entry: Example 15-1 Building a form that validates its fields before submission

Previous entry: Example 14-11 Seeing the results of magic quotes

<< Back to main