Jump to content

[SOLVED] how to insert email into database


gudfry

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.