0

hi there

i have this registration page when a user login it should redirect you to a welcome page, I am having a similar problem at to one user who was experiencing the same problem.

at one time it was going to the welcome page, but there were errors in the firstname an lasname variable. how to echo it out. apparently i had code it wrong, so it was picking up the error, try fixing and I have no idea I did or didn't know now when i tried registering, it is blank

i have a login page also and that and all is not working. here is the 2 sets of codes. one is the register.php and the other is the welcome page codes.

this is what i have so far. i know that I have asked this question before abot the name.

<?php

        if(isset($_POST['submit']))
        {
            //capture the variable from the form and store in php variables

            $title=$_POST['title'];
            $firstname=$_POST['firstname'];
            $lastname=$_POST['lastname'];
            $address=$_POST['address'];
            $txtemail=$_POST['txtemail'];
            $gender=$_POST['gender'];
            $userName=$_POST['userName'];
            $pword=$_POST['pword'];

            //connecting to the server

            $db_host="localhost";
            $db_username="root";
            $db_password="";
            $con = mysqli_connect($db_host,$db_username,$db_password) or die (mysqli_connect_error());

            //select the database you want to query

            mysqli_select_db($con, 'food') or die (mysqli_error($con));
            $sql = "SELECT * FROM member WHERE userName = '$userName'";
            $result = mysqli_query($con, $sql) or die ("Error:".mysqli_error($con));
            $rowcount=mysqli_num_rows($result);

            if($rowcount >= 1)
            {
                echo "<script type=\"text/javascript\";
                alert('username already exist');
                window.location=\"register.html\";
                </script>";
            }//.....
            else
            {
                //insert data into table

                $sql = "INSERT INTO member VALUES('$title', '$firstname', '$lastname', 
                        '$address', '$txtemail', '$gender', '$userName', MD5('$pword'))";

                if(mysqli_query($con, $sql))
                    {
                        mysqli_close($con);
                        header("location:welcome.php");
                    }
                    else
                    {
                        echo "Error inserting into database".mysqli_error($con);
                    }

            }//.......

        }
?>

the welcome page php codes. 
<?php

    session_start();

    if(isset($_SESSION['user']))
    {
        header('Location:login.php');
    }

?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11.dtd">

<html xmlns="http:www.w3.org/1999/xhtml"xml:lang="en" lang="en">

    <head>
        <title> Welcome - <?php echo "".$_SESSION['user']; ?></title>
    </head>
    <body>

            Welcome!!! <?php echo $_POST['firstname']; ?><!<br/><?php echo $_POST['lastname'];?>
            <?php
                echo " you are now a member of the Caribbean Culinary Network (CCIN). 
                        Your monthly newsletter will be email to you."
            ?>

    </body>
</html>
1
Contributor
1
Reply
9
Views
3 Weeks
Discussion Span
Last Post by divinity02
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.