Parse error: syntax error, unexpected T_IF in H:\xampp\htdocs\login.php on line 74 i don't see any mistake here?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Yakity Yak</title>
<link href='http://fonts.googleapis.com/css?family=Oswald:400,300' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Abel|Satisfy' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
  <p><!-- end #header --></p>
  <div id="header" class="container">
    <div id="logo">
      <h1><a href="#">Yakity Yak</a></h1>
    </div>
    <div id="menu">
      <ul>
        <li class="current_page_item"><a href="../../Documents/Unnamed Site 2/index.html">Homepage</a></li>
        <li><a href="../../Documents/Unnamed Site 2/trip.html">Destinations</a></li>
        <li><a href="#">contact </a></li>
        <li><a href="#">Login</a></li>
        <li></li>
        <li></li>
      </ul>
    </div>
  </div>
  <blockquote>
    <blockquote>
      <p> <center><img src="ewrf.jpg" width="999" height="300"  alt=""/></center>  </p>
    </blockquote>
  </blockquote>
  <div id="page">
    <div class="post">
      <h2 class="title"><a href="#">Welcome to Yakity yak club</a></h2>
            <div class="entry">
<h2>Admin Log In</h2>
<!--Introduction Paragraph-->
<p>
    <form action="login.php" method="POST">
    <table border="0.1">
<tr>
<td><label for="email">Email Address:</label></td>
<td><input type="text" id="email" name="email"/> <br/> </td>
</tr>
<tr>    
<td> <label for="password">Password:</label> </td>
<td> <input type="password" id="password:" name="password"/> <br/> </tr>
</tr>
</table>
  <input type="submit" value="Log In" name="LogIn" />
  </form> 
  <?php
//defining Varables
$host = "localhost";
$user = "root";
$pass = "";
$db = "admin";
$admin = "wellington@canoeandkayak.co.nz";

mysql_connect ($host, $user, $pass);
mysql_select_db ($db);

//Checking to see if the user has input any information
if(isset ($_POST['email'])) {
    $email = $_POST['email'];
    $password = $_POST['password'];
    $sql = "SELECT * FROM admin WHERE email = '".$email."' AND password = '".$password."' LIMIT 1 ";
    $res = mysql_query ($sql) or die(mysql_error())
    if ((mysql_num_rows($res) == 1) and ($email == $admin)) {
        header ("Location:homepage.php ");
        exit();
    } else {
        echo 'Sorry you do not have access to this part of the site. Please use the general "Log In" under the "Home" Tab.';
        exit();
    }
}

?>
<center><font color='white' size '5'>Not yet registered?
</font><a href='registration.php'>Sign Up Here</a>
</font>
</body>
</html>

line 73 is missing a semi-colon

you missed semicolon on line 73

i done that and now eventhough i didnt put any information in when i click on login it still directed me to homepage.php

Member Avatar for LastMitch

i done that and now eventhough i didnt put any information in when i click on login it still directed me to homepage.php

@dean.ong.14

Did you set this up correctly?

I think the reason why it redirected is on line 74:

if ((mysql_num_rows($res) == 1) and ($email == $admin)) {

Admin is you.

Does that make sense?

Since you are on local host, try close your browser and open it again then login again.

<?php
include('connect.php')
if(isset($_REQUEST['submit'])!=' ')

if($_REQUEST['name']=='' || $_REQUEST[email']=='' || $_REQUEST['password']=='' || $_REQUEST['repassword']=='')

echo "please fill the empty field."";

else

$sql="insert into register(name,email,password,repassword)
values('".$_REQUEST['name']."','".$_REQUEST['mail']."','".$_REQUEST['password'].'",'".$_REQUEST['repassword']."')";
$res=mysql_query($sql);
if($res)

echo "Successfully registered";

else

echo "not registered";

?>

Parse error: syntax error, unexpected 'if' (T_IF) in C:\xampp\htdocs\merge\registration.php on line 3

As I read this post, I found it to be very helpful. Thank you for posting it. I enjoyed reading it.

Parse error: syntax error, unexpected 'if' (T_IF) in C:\xampp\htdocs\merge\registration.php on line 3

To answer 2451-18-737-303 (albeit nearly a year late)

You're missing { and } around all of your if statements:

<?php
include('connect.php')
if(isset($_REQUEST['submit'])!=' ')
{
    if($_REQUEST['name']=='' || $_REQUEST[email']=='' || $_REQUEST['password']=='' || $_REQUEST['repassword']=='')
    {
        echo "please fill the empty field."";
    }
    else
    {
        $sql="insert into register(name,email,password,repassword)
values('".$_REQUEST['name']."','".$_REQUEST['mail']."','".$_REQUEST['password'].'",'".$_REQUEST['repassword']."')";
        $res=mysql_query($sql);
        if($res)
        {
            echo "Successfully registered";
        }
        else
        {
            echo "not registered";
        }
    }
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.