Jump to content

Archived

This topic is now archived and is closed to further replies.

aspekt9

Registration Form

Recommended Posts

[code]
<html>
<body>

<form action="login.php?page=submit" method="POST">
Enter your Username: <input type="text" name="uname" /><br>
Enter your Email address: <input type="text" name="email" /><br>
Enter your Password: <input type="text" name="password" /><br>
Enter your First Name: <input type="text" name="firstname" /><br>
Enter your Last Name: <input type="text" name="lastname" /><br>
<input type="submit value=submit" />
</form>
<?php
if ($page == "submit") {
     if (!isset($name) || $name == " ") {
        $error[] = "<b>Error:</b> Username is a required field.";
    } if (!isset($pass) || $pass = " ") {
    $error[] = "<b>Error:</b> Password is a required field.";
    } if (!isset($email) || $email = " ") {
        $error[] = "<b>Error:</b> Email address is a required field.";
    } if (!isset($firstname) || $firstname = " ") {
        $error[] = "<b>Error:</b> First name is a required field.";    
    } if (!isset($lastname) || $lastname = " ") {
        $error[] = "<b>Error:</b> Last name is a required field.";
    }
if (isset($error)) {
        $error = serialize($error);
    header("location: ?page=error&error=$error");
    die();
    }
  } if ($page == "error") {
          $error = unserialize($error);
          foreach ($problem as $error) {
               echo $problem."";
          }}
?>
</body>
</html>
[/code]

can't figure out why it wont work :( any help is greatly appreciated, thanks guys

Share this post


Link to post
Share on other sites
[code]
if ($page == "submit") {
[/code]

should be
[code]
if ($_GET["page"] == "submit") {
[/code]

there might be some more errors, but on a quick glance that's the one that jumped at me.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.