Registration Using Php & MySQL

Discussion in 'PHP' started by jojodalde, Jan 7, 2008.

  1. #1
    hey guys.. I have it set up as 3 select drop downs Month Day Year in birthdate on the html side so far but I want that 3 variable will be merge into 1 field in my database..actually i have my code below i just dont know how to fix the error; "Undefined index: d_birth in c:\program files\easyphp1-8\www\pinkbox\addclub_members.php on line 20"
    can anyone help me...thanks!


    <?php
    $con = mysql_connect("localhost","pbclub","theclub");
    if (!$con)

    {

    die('Could not connect: ' . mysql_error());
    }

    mysql_select_db("pinkbox", $con);

    $bcode=$_POST['bcode'];
    $idno=$_POST['idno'];
    $name=$_POST['name'];
    $address=$_POST['address'];

    $dbirth = '0000-00-00';
    if(checkdate($_POST['m_dbirth'], $_POST['d_dbirth'], $_POST['y_dbirth'])) {
    $dbirth = $_POST['y_dbirth'] . '-' . $_POST['m_dbirth'] . '-' . $_POST['d_birth'];
    }
    $branch=$_POST['branch'];

    $reg_date = '0000-00-00';
    if(checkdate($_POST['m_reg_date'], $_POST['d_reg_date'], $_POST['y_reg_date'])) {
    $reg_date = $_POST['y_reg_date'] . '-' . $_POST['m_reg_date'] . '-' . $_POST['d_reg_date'];
    }


    $school=$_POST['school'];
    $contact_num=$_POST['contact_num'];
    $email=$_POST['email'];


    $query="INSERT INTO club_members (bcode, idno, name, address, dbirth, branch, reg_date, school, contact_num, email) VALUES ('$bcode', '$idno', '$name','$address','$dbirth','$branch','$reg_date','$school','$contact_num','$email')";
    $result=mysql_query($query);

    if($result){
    echo "Successful!";
    echo "<BR>";
    echo "<a href='club_members.php'><font face=arial size=2>View Club Members</font></a>"; // link to view guestbook page
    }

    else {
    echo "
    <html>
    <head></head>
    <bgcolor=pink>
    <font face=bangle size=5><b>ERROR!</b>
    <br><br>
    <font face=arial narrow size=2><b>
    <a href='register.php'>back to registration</a>
    </b></font>
    </body>
    </html>
    ";
    }

    mysql_close();

    ?>
     
    jojodalde, Jan 7, 2008 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    I donot see the variable d_birth in the entire program?

    Regards

    Alex
     
    kmap, Jan 7, 2008 IP