View Full Version : getitng users dob and sex into db

02-14-2008, 11:47 AM
hey guys little stuck with this one wundering if any 1 has code i could use/edit

i need to have my form so users can add their dob and age into a db

i have no idea how to do this... i would like it so male/female can be chose so it chnages a colour so male = blue female = pink
and dob displays like so day/month/year

Andrew Johnson
02-14-2008, 12:40 PM
Do you have code for getting the rest of the user's information into your database ?

02-14-2008, 12:44 PM
at the moment i use this

require_once '../../settings.php';
checkLogin ('1 2');
$id = $_SESSION['user_id'];

$qProfile = "SELECT * FROM users WHERE id='$id' ";
$rsProfile = mysql_query($qProfile);
$row = mysql_fetch_array($rsProfile);
$dob = ($dob);
$about_me = ($about_me);
$events = ($events);
$first_name = ($first_name);
$last_name = ($last_name);


<form id="FormName" action="updated.php" method="post" name="FormName">
<table width="448" border="0" cellspacing="2" cellpadding="0">
<tr><td width="150"><div align="right">
<label for="dob">dob</label></div>
<input id="dob" name="dob" type="text" size="25" value="" maxlength="255"></td>
<tr><td width="150"><div align="right">
<label for="about_me">about_me</label></div>
<textarea id="about_me" name="about_me" rows="4" cols="40"><?php echo $about_me ?></textarea></td>
<tr><td width="150"><div align="right">
<label for="events">events</label></div>
<input id="events" name="events" type="text" size="25" value="<?php echo $events ?>" maxlength="255"></td>
<tr><td width="150"><div align="right">
<label for="first_name">first_name</label></div>
<input id="first_name" name="first_name" type="text" size="25" value="<?php echo $first_name ?>" maxlength="255"></td>
<tr><td width="150"><div align="right">
<label for="last_name">last_name</label></div>
<input id="last_name" name="last_name" type="text" size="25" value="<?php echo $last_name ?>" maxlength="255"></td>
<td width="150"></td>
<td><input type="submit" name="submitButtonName" value="Update"><input type="hidden" name="id" value="<?php echo $id ?>"></td>

to update it wich goes onto


<a href="index.php">Back to List</a><br>


$id = $_POST['id'];
$dob = $_POST['dob'];
$about_me = $_POST['about_me'];
$events = $_POST['events'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];

$update = "UPDATE users SET dob = '$dob', about_me = '$about_me', events = '$events', first_name = '$first_name', last_name = '$last_name' WHERE id='$id' ";
$rsUpdate = mysql_query($update);
if ($rsUpdate)
echo "Update successful.";
} mysql_close();

02-14-2008, 05:12 PM
any ideas any 1?

all i want to do simpky is add users date of birth and sex into a db