gudfry Posted August 8, 2008 Share Posted August 8, 2008 hi all; can anyone tell me where can i find a good example for this; i have this whole code $name = $_POST['name']; $sender = $_POST['e_mail']; $phone = $_POST['phone']; $subject = $_POST['subject']; $message = $_POST['message']; $email = $_POST['email']; // Insert data into hotelinfo table $sql="INSERT INTO mailRecord(name, sender, phone, subject, fax, message) VALUES('$name', '$sender', '$phone', '$subject', '$message')"; $result=mysql_query($sql); mysql_close(); $to = ''.$email.'' . ', '; // note the comma $to .= 'frankcris@xxxxx.xxx'; $subject = "$subject"; $body = "Guest message.\n\n $message\n\n"; mail ($to , $subject, $body, 'From: '.$sender.''); ?> <script type="text/javascript"> alert("Thank you for sending a message!") window.history.back(1); </script> I cant inseert the data into database. pleas hlp me thank for advance Quote Link to comment https://forums.phpfreaks.com/topic/118734-solved-how-to-insert-email-into-database/ Share on other sites More sharing options...
mmarif4u Posted August 8, 2008 Share Posted August 8, 2008 Are you connected to database. Quote Link to comment https://forums.phpfreaks.com/topic/118734-solved-how-to-insert-email-into-database/#findComment-611333 Share on other sites More sharing options...
sKunKbad Posted August 8, 2008 Share Posted August 8, 2008 You might try reversing your single and double quotes in your sql statement: $sql='INSERT INTO mailRecord(name, sender, phone, subject, fax, message) VALUES("$name", "$sender", "$phone", "$subject", "$message")'; and the table name and fields may be case sensitive. Quote Link to comment https://forums.phpfreaks.com/topic/118734-solved-how-to-insert-email-into-database/#findComment-611334 Share on other sites More sharing options...
gudfry Posted August 8, 2008 Author Share Posted August 8, 2008 yes, Im connected to my database Quote Link to comment https://forums.phpfreaks.com/topic/118734-solved-how-to-insert-email-into-database/#findComment-611335 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.