Search the Community
Showing results for tags 'php coding problem'.
-
please friends i have a problem trying to create a form for my web site please this is the code <?php $required=array("fname" => "Firstname", "lname" => "Lastname", "email" => "Email address", "password" => "Password"); foreach ($required as $field => $label) { if (!$_post[$field]) { $warnings[$field] = "Required"; } } if ($_POST["email"] && !ereg("^[^@]+@([a-z\-]+\.)+[a-z]{2,4}$", $_POST["email"])) $warnings["email"] = "Invalid email"; if ($_POST["telephone"] && !ereg("^\([[:digit:]]{3}\)[[:digit:]]{3}-[[:digit:]]{4}$", $_POST["telephone"])) $warnings["telephone"] = "Must be (555)555-5555"; if (count($warnings) > 0) { ?> <form action = "register.php" method=post> <table border=0> <tr> <td>Firstname:</td> <td><input type=text size=30 name="fname" value="<?php echo $_post ["fname"];?>" > </td> <td><?php echo $warnings["fname"];?> </td> </tr><br/> <tr> <td>Lastname:</td> <td><input type=text size=30 name="lname" value="<?php echo $_post ["lname"];?>"> </td> <td><?php echo $warnings["lname"];?> </td> </tr> <tr> <td>Email address:</td> <td><input type=text size=30 name="email" value="<?php echo $_post["email"];?>"> </td> <td><?php echo $warnings["email"];?> </td> </tr> <tr> <td>Password:</td> <td><input type=text size=30 name="password" value="<?php echo $_post["password"];?>"> </td> <td><?php echo $warnings["password"];?> </td> </tr> <tr> <td>Telephone:</td> <td><input type=text size=30 name="telephone" value="<?php echo $_post["telephone"]?>"> </td> <td><?php echo $warnings["telephone"];?> </td> </tr> <tr> <td>Sex</td> <td><script src="sex.php"> </script></td> </tr> <tr> </TABLE> <INPUT TYPE=SUBMIT VALUE="Register"> </form> <?php } else { echo "Thank you for registering"; } ?> and this are the error messages, am a newbie to php please help and this is the error message Notice: Undefined variable: _post in C:\xampp\htdocs\form.php on line 8 Notice: Undefined variable: _post in C:\xampp\htdocs\form.php on line 8 Notice: Undefined variable: _post in C:\xampp\htdocs\form.php on line 8 Notice: Undefined variable: _post in C:\xampp\htdocs\form.php on line 8 Notice: Undefined index: email in C:\xampp\htdocs\form.php on line 13 Notice: Undefined index: telephone in C:\xampp\htdocs\form.php on line 16 please help me out
- 25 replies
-
- php coding problem
- form problem
- (and 2 more)