-1

This is a registration page code. I don't know why it is giving me a syntax error. Although everything in the page seems fine. Here is the code:

<?php

// Grab User submitted information
if (isset($_POST["Register"])) {
$name = $_POST["Name"];
$email = $_POST["Email_Address"];
$utdid = $_POST["Utd_ID"];
$uname = $_POST["Email_Address"];
$password = $_POST["Password"];

// Connect to the database
$con = mysql_connect("localhost","root","");
// Make sure we connected succesfully
if(! $con)
{
    die('Connection Failed'.mysql_error());
}

// Select the database to use
mysql_select_db("planner",$con);

$result = mysql_query("INSERT INTO User(Name, UtdId, Username, Password) VALUES ('$name', '$utdid', '$uname', '$password')");

if($result) {
    session_start();

    $_SESSION['logged_user']= $uname;
    header("Location:CS_MS_Plan.php”);
}

else
{ ?>
    <script>alert(“error”);</script>
<?php
}

?>

Similar code works like a peach for login. Any ideas?

suv_12
  • 3
  • 2
  • 1
    Indent your code and it should show you where something wasn't closed. Also you are open to SQL injections. – chris85 Jul 05 '15 at 19:28

1 Answers1

0

this if is not closed

if (isset($_POST["Register"])) {
splash58
  • 25,216
  • 3
  • 19
  • 31