Thread: PHP errors?
View Single Post
Old 01-20-2013, 05:14 PM   PM User | #6
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,645
Thanks: 4
Thanked 2,450 Times in 2,419 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
That can be fixed by checking the isset status:
PHP Code:
<?php

if (isset($_POST['name'], $_POST['size'], $_POST['gender']))
{
    
$name=$_POST['name'];
    
$size=$_POST['size'];
    
$gender=$_POST['gender'];

    print 
"<p>Name: $name<br />Size: $size<br />Gender: $gender</p>";
}
else
{
    
header('Location: http://yoursite.com/yourform.html');
    exit();
}
?>
Would do it. You'll get very familiar with the isset construct in PHP.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote