hi all;

can anyone tell me where can i find a good example for this;
i have this whole code

<?php
$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@activediscovery.net';

$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

Why is this marked as solved? Did you found solution? If so please share with others...

Member Avatar

hi all;

can anyone tell me where can i find a good example for this;
i have this whole code

<?php
$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@activediscovery.net';

$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

I don't see any connection to Db

// $to = ''.$email.'' . ', '; // note the comma << DON'T USE
// $to .= 'frankcris@activediscovery.net'; << DON'T USE
// $subject = "$subject"; << DON'T USE

$body = "Guest message.\n\n $message\n\n";

// USE ONE MAIL FUNCTION PER EMAIL
mail ($email, $subject, $body, 'From: '.$sender.'');
mail ("frankcris@activediscovery.net", $subject, $body, "From: ".$sender);