Jump to content

Recommended Posts

 

I'm just trying to get a form to submit data to mysql database.

I am working with the following but so far no luck

What am I missing here?  :-\

 

mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($database);

if (isset($_POST['Submit'])) 
{

$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];

mysql_query("INSERT INTO $table (col_2, col_3, col_4, col_5) VALUES ('$name', '$email', '$subject', '$message')");

    $user = $_POST['name'];

    echo '<table id=table1><tr><td><b><font size=2>Thank you ' . $user . ', your form was was submitted.</font></b></tr></td>';


}
?>

Link to comment
https://forums.phpfreaks.com/topic/104155-solved-form-to-database/
Share on other sites

What happens? Do you at least see the "Thank you" message?

 

Add a die() to the end of your query

mysql_query("INSERT INTO $table (col_2, col_3, col_4, col_5) VALUES ('$name', '$email', '$subject', '$message')")or die(mysql_error());

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.