www.webdeveloper.com
Results 1 to 3 of 3

Thread: dealing with form post buttons

  1. #1
    Join Date
    Feb 2013
    Posts
    1

    dealing with form post buttons

    Why wont my "(isset($_POST['register_button'])){" respond when i press the forms submit button?








    <?php
    include 'connect.php';
    ?>
    <title>Registration</title>

    <form method='post'>
    <?php
    if(isset($_POST['register_button'])){
    $username = $_POST['username'];
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $email = $_POST['email'];
    $password = $_POST['password'];
    $confirm_password = $_POST['confirm_password'];

    if(empty($username) or empty($first_name)){
    echo'fields missing!';
    } else if ($password != $confirm_password) {
    echo"confirm password didnt match";
    } else {
    mysql_query("INSERT INTO members VALUES('', '$first_name', '$last_name', '$username', '$email', '$password')");
    echo "Successfully Registered";
    }

    }
    ?>
    Name: <br/>
    <input type='text' name='first_name' />
    <input type='text' name='last_name' />
    <br /><br />
    User Name : <br />
    <input type='text' name='username' />
    <br /><br/>
    email ID : <br/>
    <input type='email' name='email' />
    <br/><br/>
    Password :
    </form><br>
    <input type='password' name='password' />
    <br/><br/>
    Confirm Password:
    <br/>
    <input type='password' name='confirm_password' />
    <br/><br/>
    <input type='submit' value='submit' id='button' name='register_button' />

    </form>

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,222
    Perhaps because that submit button is not within a form?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Oct 2012
    Location
    Gujarat, India.
    Posts
    35
    THAT BOLD (end of )ELEMENT!!!

    Password :
    </form><br>
    <input type='password' name='password' />
    <br/><br/>
    Confirm Password:
    <br/>
    <input type='password' name='confirm_password' />
    <br/><br/>
    <input type='submit' value='submit' id='button' name='register_button' />

    </form>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles