I'm having trouble with a php script on my form handler page of my test website. The form is for user registration. It's objective is to take the form data, check to make sure both passwords match to eliminate typos, and finally submit the data to the server for storing.
Yesterday, everything worked like a charm. Today, however, I attempted to add a new user via the form and it threw my "Could Not Update" error. I checked my include file, my index.php file, and finally my php file that handles the actual updating and password checking. Everything was fine. I changed nothing from yesterday to today.
You can see where my frustration would begin to set in. Below is the code that handles the legwork. (registerNow.php)
<?php
include 'connect.php';
$user = $_POST['username'];
$pass = $_POST['password'];
$rpass = $_POST['repass'];
$first = $_POST['firstName'];
$last = $_POST['lastName'];
$mail = $_POST['email'];
$bday = $_POST['month'].$_POST[ 'day'].$_POST['year'];
if ($pass <> $rpass)
{
echo '<h3 style="position: relative; top: 100px; left: 25px;">Please type your password correctly twice for verification.</h3>';
}
else
{
$query = ("INSERT INTO users (username, password, firstName, lastName, email, birthday) VALUES ('$user', '$pass', '$first', '$last', '$mail', '$bday')");
$result = mysqli_query($link, $query) or die ("Could not update the server");
}
?>
There is other code in the file but it is above this section and merely HTML/CSS. $bday combines the result of three dropdown boxes and saves them in the field birthday in the users table which is text. I know others say to use the actual date format but I found this to be faster.
Again, the problem is the code never updates the server with the entered information and displays my "or die" message. I'm using MySQLi on a Windows XP Server/Database. The code worked just yesterday but not today. I've tried restarting the web server and the MySQL service. Still nothing. Does anyone know what could have happened or why this code doesn't carry out the desired action?
I appreciate it. Thanks.
Yesterday, everything worked like a charm. Today, however, I attempted to add a new user via the form and it threw my "Could Not Update" error. I checked my include file, my index.php file, and finally my php file that handles the actual updating and password checking. Everything was fine. I changed nothing from yesterday to today.
You can see where my frustration would begin to set in. Below is the code that handles the legwork. (registerNow.php)
<?php
include 'connect.php';
$user = $_POST['username'];
$pass = $_POST['password'];
$rpass = $_POST['repass'];
$first = $_POST['firstName'];
$last = $_POST['lastName'];
$mail = $_POST['email'];
$bday = $_POST['month'].$_POST[ 'day'].$_POST['year'];
if ($pass <> $rpass)
{
echo '<h3 style="position: relative; top: 100px; left: 25px;">Please type your password correctly twice for verification.</h3>';
}
else
{
$query = ("INSERT INTO users (username, password, firstName, lastName, email, birthday) VALUES ('$user', '$pass', '$first', '$last', '$mail', '$bday')");
$result = mysqli_query($link, $query) or die ("Could not update the server");
}
?>
There is other code in the file but it is above this section and merely HTML/CSS. $bday combines the result of three dropdown boxes and saves them in the field birthday in the users table which is text. I know others say to use the actual date format but I found this to be faster.
Again, the problem is the code never updates the server with the entered information and displays my "or die" message. I'm using MySQLi on a Windows XP Server/Database. The code worked just yesterday but not today. I've tried restarting the web server and the MySQL service. Still nothing. Does anyone know what could have happened or why this code doesn't carry out the desired action?
I appreciate it. Thanks.