Ok I saw my error in the code above. I had 2 sets of "" just
="<?php echo("$PHP_SELF")?>" "
I removed one. and now it is giving a different parse error. This is
Parse error: parse error, unexpected '{' in D:\defaultWeb1\Noname1.php on line 18
This is my complete code
<html>
<head>
<title>Insert Data</title>
</head>
<body>
<center><form action"<?php echo("$PHP_SELF")?>" method="post">
First Name <INPUT TYPE="text" NAME="firstname" size ="40"><br>
Last Name <input type="text" name="lastname" size ="40"><br>
email address <input type="text" name="email" size="40"><br>
<br>
<INPUT TYPE="submit" name="submit" value="Submit!">
</FORM></center>
<?php
if(isset($_POST['submit']) {
$firstname= trim ( $_POST['firstname'] );
$lastname = trim ($_POST['lastname'] );
$email = trim ($_POST['email'] );
if($firstname!="" && $lastname!="" && $email!="") {
$conn= mysql_connect("localhost", "root", "") or die("connection error");
mysql_select_db("address", $conn) or die("Could not find database you specified ");
$query ="INSERT into details VALUES('$firstname', '$lastname', '$email')";
$result=mysql_query ($query) or die ("There has been a problem with executing the query.");
if($result)
echo 'Thankyou. The information you submitted, has been added to the database.';
}
}
?>
</body>
</html>
On line 18 is this line
if(isset($_POST['submit']) {
I dont know if the { should be there. I tried to remove it and still does not work ;-=(