Help with a registration form

Hello, I have built a registration form and it is inserting the data into the database, but it is not giving the Successfull message after the user pushes the enter button, Can you please help me?

Here is my code:
[php]

<?php //Get Values from Form $Fname =$_POST['first_name']; $Lname =$_POST['last_name']; $telephone =$_POST['telephone']; $email =$_POST['email']; //Insert data in to MySql $sql="INSERT INTO event1 (first_name, last_name, telephone, email) VALUES ('$Fname', '$Lname', '$telephone', '$email')"; $result = mysql_query($sql); //if successfully insert data into database, display message. if($result){ ?>
You have successfully registered.
<?php } else { echo "ERROR"; } //close MySQL mysql_close();
//We display the form

?>

Please fill the following form to Register:

First Name
Last Name
Telephone #
Email

[/php]

A few things first,

Don’t use mysql_ functions.
Do user prepared statements.
You should be using sql queries in an exception block so errors can be reported properly.

[php]

You have successfully registered.
[/php]

This is not complete. Are you sure it isn’t displaying? Possibly it is hidden behind something else?

A few more things.

If you had error reporting turned on you would see you have problems. Your script is going to try and run the query on page load and there are no POST values.

Where do you expect the php values in your form to come from?

Sponsor our Newsletter | Privacy Policy | Terms of Service