Hi devinemke,
Firstly, the login model I am working from can be found in http://evolt.org/article/comment/17/60265/index.html but I have modified it extensively. It does have a if (isset($_POST['submit'])) feature in the Register.php file. I have assumed it best to place your code within that feature (I have also placed it in other places) as follows;
if(isset($POST['subjoin'])){
/ Making sure username field is entered /
if(!$POST['user']){
die("You did not fill in Your Username field, please <A HREF=\"Register.php\" TITLE=\"fill in that field.\">fill in that field.</A>");
}
/ Spruce up username, checking length /
$POST['user'] = trim($POST['user']);
if(strlen($POST['user']) > 20){
die("Sorry, the username is longer than 20 characters, please <A HREF=\"Register.php\" TITLE=\"shorten it.\">shorten it.</A>");
}
/ Check if username is already in use /
if(usernameTaken($POST['user'])){
$use = $POST['user'];
die("Sorry, the username: <strong>$use</strong> is already taken, please <A HREF=\"Register.php\" TITLE=\"choose another.\">choose another.</A>");
}
$mysql_date = $POST['year'] . '-' . $POST['month'] . '-' . $POST['day'];
echo $mysql_date;
and I have also modified (by guesswork only) the other coding;
$SESSION['reguname'] = $POST['user'];
$mysql_date = $POST['birthdate'];
$SESSION['regresult'] = addNewUser($POST['user'], $POST['birthdate']);
$_SESSION['registered'] = true;
echo "<meta http-equiv=\"Refresh\" content=\"0;url=$HTTP_SERVER_VARS[PHP_SELF]\">";
return;
}
else{
?>
and also inserting into the database;
function addNewUser($username, $birthdate){
global $conn;
$q = "INSERT INTO users VALUES ('$username', '$birthdate')";
return mysql_query($q,$conn);
}
and I have tried every conceiveable variation, but still can not get the date to enter the database. It would appear as if the problem lies in the POST or INSERT INTO function.
The other matter I need to resolve is when the A HREF function above is activated and the page reverts back to Register.php, all the data is deleted, what do I need to do to have the entered data restored?
Is there a site I can visit where I can learn what each group of charactors create or activate as currently I am playing around in the dark and guessing every thing I do?
Regards, David Young.