Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6878327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:42:36+00:00 2026-05-27T04:42:36+00:00

This is my first page, which would be my login page. The user types

  • 0

This is my first page, which would be my login page. The user types in their username, hits login, and then the broswer should take them to login.php Index.html

<html>
<head>
<title>Login</title>
</head>
<body >

<br><br><br><br><h2 align=center>Quiz Taker</h2>
<br><br><br>
<p align=center></p>

<br>
    <form method="post" action="login.php">
        <table class="login" cellpadding=10 cellspacing=0 align="center" bgcolor="#cccccc" border="3">
        <tr>
            <td>
            <input type="radio" name="userType" value="Student"/> Student
            <input type="radio" name="userType" value="Teacher"/> Teacher
             <td>
             Username:</td><td><input type="text" name="username" size=10>
             </td>
        </tr>
        <tr>
             <td colspan=2 align="center">
             <input type="submit" name="submit" value="  Log In  ">
             </td>
        </tr>
    </table>
    </form>


</body>
</html>

When the user hits submit it will go to login.php which looks like this:

<?php

include_once("DatabaseConnection.php");

$stmt=$DBH->prepare("SELECT * FROM QuizUser where Name=?")
$stmt->bindValue(1, $_POST['username']);
$stmt->execute();
if ($row=$stmt->fetch())
    {
        $ID=$row['ID'];
    }
    else
    {

        $stmt=$DBH->prepare("INSERT INTO QuizUser(Name) VALUES(?)")
        $stmt->bindValue(1, $_POST['username']);
        $stmt->execute();
        $ID=$DBH->lastInsertId();
    }
    $_SESSION['userID']= $ID;
    $_SESSION['userName']= $_POST['username'];
    $_SESSION['userType']=$_POST['userType'];

    if($_POST['userType'] == "Student")
    {
        header($string["Location:student.php"]);
    }
    else 
    {
        header($string["Location:teacher.php"]);    
    }

    ?>

Which is not working and I cannot figure out why. It just pops up a parse error: syntax error, unexpected T_VARIABLE in ….myfile…. at line whever the first time I try and use the $_POST variable. By the way, I am starting my session in the DataBaseConnection.php that is imported at the top of login.php.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:42:37+00:00Added an answer on May 27, 2026 at 4:42 am

    Your header functions are written incorrectly.

    header($string["Location:student.php"]);
    

    should be

    header("Location: student.php");
    

    Likewise,

    header($string["Location:teacher.php"]);
    

    should be

    header("Location: teacher.php");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a standard HTML login page, which I would much rather use than
This is my first time attempting to call an ASP.NET page method from jQuery.
The first two paragraphs of this page explain that generic views are supposed to
Ok, first off, I didn't program this page with frames! I'll be getting rid
I would like to access profiles table from my Profile model which belongs_to :user
I have a user input form here: http://www.7bks.com/create (Google login required) When you first
This first bit works: $my_id = 617; $post_id_7 = get_post($my_id); $title = $post_id_7->post_excerpt; echo
Saw this piece of code in a Ruby on Rails book. This first one
problem euler #5 i found the solution but i don't know why this first
Using Dozer to map two objects, I have: /** /* This first class uses

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.