e help me with my code? I am trying to get the user's full_name through the login info that was provided (email and password) but it shows an error. I want to show the user's name that corresponds to the email and password. For example, email: iya@gmail.com password: starlight-subtly-causal-dynamic then the welcome.php will show a message like this "Welcome, Iya Salvador!"   login.php     Pexzbook

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Hi! Please help me with my code? I am trying to get the user's full_name through the login info that was provided (email and password) but it shows an error. I want to show the user's name that corresponds to the email and password. For example, email: iya@gmail.com password: starlight-subtly-causal-dynamic then the welcome.php will show a message like this "Welcome, Iya Salvador!"

 

login.php

<!DOCTYPE html>
<html>
<head>
    <title> Pexzbook </title>
    <link rel="stylesheet" href="css\style.css" />
    <style>
        .footer{
            margin-top: 173px;
            background-color: #4f81bd;
            padding: 35px;
        }

        .field{
            margin-bottom: 15px;
            margin-left: 33px;
        }

        .field2{
            margin-bottom: 15px;
        }

        #email{
            color: black;
            margin-left:40px;
            margin-bottom: 15px;
        }

        #form{
            float: right;
            margin-right: 80px;
            margin-bottom: 80px;
        }

        div.col-1 img{
        width: 699px;
        padding-top: 80px;
        padding-left: 50px;
        }

        .input {
            color: black;
        }
    </style>
</head>

<body>
    <div class="container">
    <div class="navbar" style="background-color: #4f81bd;">
       <img src="images\pexzbook.png" />
    </div>
    <div class="row">
        <div class="col-1">
            <img src="images\map.png" />
        </div>
        <div id="form">
            <form action="login.php" method="post">
                <p class="input">
                    <label><b>Email:</b></label>
                    <input type="text" class="field" id="email "name="email" size="35">
                </p>

                <p class="input">                  
                    <label><b>Password:</b></label>
                    <input type="password" class="field2" name="password" size="35">
                </p>

                    <input type="submit" id="btn" name="login" value="Login" size="15">

            </form>
        </div>
    </div>


    <div class="footer"> </div>

<?php
    require ("connection.php");

    if (isset($_POST['login'])){
        $email = $_POST['email'] ;
        $password = $_POST['password'];

        $result = mysqli_query($conn, "SELECT * FROM account WHERE email = '$email' AND password = '$password' ");
        $row = mysqli_fetch_array($result);

        if (is_array($row)){
            $_SESSION["email"] = $row ['email'];
            $_SESSION["password"] = $row ['[password]'];
           

        } else{
        echo '<script type = "text/javascript">';
        echo 'alert("Incorrect Email or Password!");';
        echo 'window.location.href = "login.php"';
        echo '</script>';
        }
    }

    if(isset($_SESSION["email"])){
        header("Location:welcome.php");
    }
?>
</body>
</html>
 
 
 
welcome.php
<?php
session_start();
?>

<!DOCTYPE html>
<html>
<head>
    <title> Welcome</title>
</head>
<body>
    <h3> Welcome </h3>
    <?php echo $row ['full_name']; ?>
</body>
</body>
 
 
 
 
style.css
*{
  margin: 0%;
  padding: 0%;
  font-family: 'Roboto', sans-serif;
  box-sizing: border-box;
}

.navbar {
  background-color: #4f81bd;
}

.navbar img{
  width: 800px;
}

div.col-1{
  width: 60%;
}


.container {
  max-width: auto;
  margin: auto;
}


#btn {
  background-color: #71a8d8;
  border: none;
  color: white;
  padding: 10px 20px;
  text-align: center;
  float: right;
  text-decoration: none;
  font-size: 17px;
}
 
+ Options
account_ID
email
password
full_name
Edit 3i Copy
Delete
1 iya@gmail.com starlight-subtly-causal-dynamic lya Salvador
Edit 3i Copy
Delete
2 ivy@gmail.com durable-exhume-eggnog-recant Ivy Riego
O Check all
With selected:
Edit
i Copy
O Delete
Export
Transcribed Image Text:+ Options account_ID email password full_name Edit 3i Copy Delete 1 iya@gmail.com starlight-subtly-causal-dynamic lya Salvador Edit 3i Copy Delete 2 ivy@gmail.com durable-exhume-eggnog-recant Ivy Riego O Check all With selected: Edit i Copy O Delete Export
O localhost/pexzbook/welcome.php
Welcome
Warning: Undefined variable Srow in C:\xampp\htdocs\pexzbook\welcome.php on line 12
Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\pexzbook\welcome.php on line 12
Transcribed Image Text:O localhost/pexzbook/welcome.php Welcome Warning: Undefined variable Srow in C:\xampp\htdocs\pexzbook\welcome.php on line 12 Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\pexzbook\welcome.php on line 12
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY