0

Earlier today I created simple database (user and login fields), login, and registration PHPs.

Now I need help going about the following enhancement:
In a nutshell: I am trying to create a registration form like facebook's with php code (and link it a mysql database)...

1.) My updated registration.php has 5 fields:

  1. "Full Name" (text)(40)
  2. "Your Email" (which is equal to username for my site's login, use text? not sure?)(40)
  3. "Create Password" (text)(40)
  4. "Birthday" (3 drop downs with following options: (Month: ) "Jan thru Dec", (Day: ) "1 thru 31", (Year: ) 1933 thru 2008
  5. "Gender" (single drop down with 2 options: "female", "male")

I have no clue for adding the birthday and gender dropdowns to mySQL because of their drop down options.

Here is what my code looks like (please share if you see any errors, some of my code was grabbed from web so I really am not sure if the "post"s are setup correctly now).

<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td><FONT FACE="Rockwell" color="#666666" SIZE="2">Full Name</FONT></td><td><input type="text" name="name" maxlength="40"></td></tr>
<tr><td><FONT FACE="Rockwell" color="#666666" SIZE="2">Your Email</FONT></td><td><input type="text" name="user" maxlength="30"></td></tr>
<tr><td><FONT FACE="Rockwell" color="#666666" SIZE="2">Create Password</td><td><input type="password" name="pass" maxlength="30"></td></tr>
<tr><td>
<tr><td><FONT FACE="Rockwell" color="#666666" SIZE="2">Birthday</FONT></td><td>
    <select name="update_mybirthmonth">
        <option value='1'>Jan</option>
        <option value='2'>Feb</option>
        <option value='3'>Mar</option>
        <option value='4'>Apr</option>
        <option value='5'>May</option>
        <option value='6'>Jun</option>
        <option value='7'>Jul</option>
        <option value='8'>Aug</option>
        <option value='9'>Sep</option>
        <option value='10'>Oct</option>
        <option value='11'>Nov</option>
        <option value='12'>Dec</option>
    </select>
    <select name="update_mybirthday">
        <? for($i = 1; $i <= 31; $i++) : ?>
            <option value="<?=$i;?>"><?=$i;?></option>
        <? endfor; ?>
    </select>
    <select name="update_mybirthyear">
        <? for($i = 1933; $i <= 2008; $i++) : ?>
            <option value="<?=$i;?>"><?=$i;?></option>
        <? endfor; ?>
    </select>
<tr><td><FONT FACE="Rockwell" color="#666666" SIZE="2">Gender</FONT></td><td>
    <select name="update_mybirthmonth">
        <option value='1'>female</option>
        <option value='2'>male</option>
</form></td></tr>

<tr><td>
<tr><td colspan="2" align="right"><input type="submit" name="subjoin" value="Sign Up"></td></tr>
</table>
</form>

<?php 
if(isset($_POST['Submit']))
{
    $update_mybirthmonth = $_POST['update_mybirthmonth'];
    $update_mybirthday = $_POST['update_mybirthday'];
    $update_mybirthyear = $_POST['update_mybirthyear'];

    if (($update_mybirthmonth >= 1) AND ($update_mybirthmonth >= 1) AND ($update_mybirthday >= 1) AND ($update_mybirthday <= 31) AND ($update_mybirthyear >= 0) AND ($update_mybirthyear <= $this_year))
    {
        include 'functions/DbConnector.php';
        $birthday = "$update_mybirthmonth-$update_mybirthday-$update_mybirthyear";
        mysql_query("UPDATE login SET birthday = '$birthday' WHERE username = 'Valerij'") or die ("Database error: ".mysql_error());
    }
}
?>
</head>

Does anyone know the code for creating a mySQL database that can grab from this information?

What code should I use to make this information available to users' unique member page?

Thanks in advance (a million!).

2
Contributors
1
Reply
4
Views
6 Years
Discussion Span
Last Post by jkon
1

A MySQL code that grabs form variables? …A database code that connects to view ? .. That is where programming is in middle even with Visual Basic or dot Net even with Java or Ruby ……. You are in a PHP thread just use PHP … ( 2 minutes searching on internet will give you the answer )

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.