Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\ovi2\signup.php on line

bakul

New Member
Messages
12
Reaction score
0
Points
0
I have big problem to error php code. Please help me to solve it.

My php code is-


<?php
$fusername=$_POST["User Name"];
$ffullname=$_POST["full Name"];
$femail=$_POST["E-mail"];
$fpassword=$_POST["password"];
$con=mysql_connect("localhost","root","");
if (!$con)
{
die('could not connect:' .mysql_error())
}
mysql_select_db("alhera", $con);

mysql_query("INSERT INTO form('user name', 'full name', 'e-mail', 'password')
VALUES('$fusername','$ffullname','$femail','$fpassword')");
echo "Your record successfully added";


mysql_close($con);
?>
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Re: Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\ovi2\signup.php on l

You should have included the entire error message. You cut of what line.

My guess:

die('could not connect:' .mysql_error())


needs a semicolon at the end of it.
 

bakul

New Member
Messages
12
Reaction score
0
Points
0
Re: Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\ovi2\signup.php on l

Thanks for suggestion. This problem is solve but new problem is create. please solve it. New problem is


Notice: Undefined index: user name in C:\xampp\htdocs\ovi2\signup.php on line 2

Notice: Undefined index: full name in C:\xampp\htdocs\ovi2\signup.php on line 3

Notice: Undefined index: e-mail in C:\xampp\htdocs\ovi2\signup.php on line 4

Notice: Undefined index: password in C:\xampp\htdocs\ovi2\signup.php on line 5
Your record successfully added
 

duongca69

New Member
Messages
8
Reaction score
0
Points
1
Re: Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\ovi2\signup.php on l

You need to check submit button.
Ex: if(isset($_post['submit'])){
Your_Code_Here;
}
 

bakul

New Member
Messages
12
Reaction score
0
Points
0
Re: Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\ovi2\signup.php on l

the new problem is

Notice: Undefined variable: fusername in C:\xampp\htdocs\ovi2\signup01.php on line 18

<?php
$submit = isset($_POST["submit"]) ? true : false;

if ($submit)
{
$fusername=$_POST["user name"];
$ffullname=$_POST["full name"];
$femail=$_POST["e-mail"];
$fpassword=$_POST["password"];
} $con=mysql_connect("localhost","root","");
if (!$con)
{
die('could not connect:' .mysql_error());
}
mysql_select_db("alhera", $con);

mysql_query("INSERT INTO form('user name', 'full name', 'e-mail', 'password')
VALUES('$fusername','$ffullname','$femail','$fpassword')");
echo "Your record successfully added";


mysql_close($con);
?>
 

duongca69

New Member
Messages
8
Reaction score
0
Points
1
Re: Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\ovi2\signup.php on l

Code:
<form action="" method="post">
    User Name: <input type="text" name="username"/><br/>
    Full Name: <input type="text" name="fullname"/><br/>
    Email    : <input type="text" name="email"/><br/>
    Password : <input type="password" name="password"/><br/>
    <input type="submit" value="Submit Form" name="submit"/>
</form>
<?php
if (isset($_POST['submit'])) {
    $userName = $_POST["username"];
    $fullName = $_POST["fullname"];
    $email = $_POST["email"];
    $password = $_POST["password"];
    $con = mysql_connect("localhost", "root", "");
    if (!$con) {
        die('could not connect:' . mysql_error());
    }
    mysql_select_db("alhera", $con);

    mysql_query("INSERT INTO form('user name', 'full name', 'e-mail', 'password') VALUES('$userName','$fullName','$email','$password')");
    echo "Your record successfully added";
    mysql_close($con);
}
?>
 
Last edited:

bakul

New Member
Messages
12
Reaction score
0
Points
0
Re: Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\ovi2\signup.php on l

Thanks for suggestion, its work but not entry to db.
 
Top