hi it is me again, this is my assignemet been trying to fix this php script for a long time
first to begin, it was issuing an error,
Warning: join(): Invalid arguments passed in C
this is the first error
and the second error was: notice: undefined index in c.
apprently if my html code, i had register a the values when registering but in my php code i had enter instead, so i fix it right
now after i finished fixing it, i tried to register a user and now i am getting a blank page, dont know what is the cause but maybe a third eye can see what I cant. please help
here is what i have tried.
<?php
//$register=$_POST['register_user'];
if(isset($_POST['register']))
{
//capture the variable from the form and store in php variables
$title=$_POST['title'];
$firstname=$_POST['fname'];
$lastname=$_POST['lname'];
$username=$_POST['username'];
$email=$_POST['email'];
$gender=$_POST['gender'];
$service= join(", ", $_POST['services']);
$address=$_POST['address'];
$mypwd=$_POST['mypwd'];
include'db_server.php';
//Query the database
$sql="SELECT * FROM members WHERE username='$username'";
$result= mysqli_query($conn, $sql) or die ("ERROR:" .mysqli_error($conn));
$rowcount=mysqli_num_rows($result);
//checking to see if username is already exist
if($rowcount >= 1)
{
echo "<script type=\"text/javascript\">
alert('Username already exits');
window.location=\"../xhtml/register_user.html\";
</script>";
}
else
{
//insert data into table
$sql = "INSERT INTO members
VALUES('$title', '$firstname', '$lastname', '$username', '$email', '$gender', '$service', '$address', md5('$mypwd'))";
if(mysqli_query($conn,$sql))
{
echo "<script type=\"text/javascript\">
alert('Welcome!! $firstname $lastname, you are now a member of the Caribbean Nature Seekers Institute TT(CNSITT)');
window.location=\"../index.html\";
</script>";
mysqli_close($conn);
}
else
{
echo "Error inserting values into database";
}
//end of line
}
}
?>