Lambneck Posted May 5, 2008 Share Posted May 5, 2008 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>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/104155-solved-form-to-database/ Share on other sites More sharing options...
pocobueno1388 Posted May 5, 2008 Share Posted May 5, 2008 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()); Quote Link to comment https://forums.phpfreaks.com/topic/104155-solved-form-to-database/#findComment-533221 Share on other sites More sharing options...
june_c21 Posted May 5, 2008 Share Posted May 5, 2008 try this see it work or not $query="INSERT INTO table_name (col_2, col_3, col_4, col_5) VALUES ('$name', '$email', '$subject', '$message')"; $result = mysql_query($query,$dblink); Quote Link to comment https://forums.phpfreaks.com/topic/104155-solved-form-to-database/#findComment-533223 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.