Jump to content

PHP Email and submit to database


nagger2000

Recommended Posts

Grateful if anyone could help.

 

I am using the following php to submit a form to a database but I also want to have the details of the same form emailed too.  Just not sure how to go about it?

 

<?php
$con = mysql_connect("XXXXXX.xxx.XXXX", "XXXXXX", "XXXXX");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("xxxxxxxxx_xxx_xx", $con);

$sql="INSERT INTO database table (name, age, email, contact, Schoolorcollege, date, hear)
VALUES
('$_POST[name]', '$_POST[age]','$_POST[email]','$_POST[contact]','$_POST[schoolorcollege]','$_POST[date]','$_POST[hear]')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
  echo "<meta http-equiv='Refresh' content='0; URL=http://www.xxxxxxxxxx.com/thankyou.php'>";
   mysql_close($con)
?>

Link to comment
https://forums.phpfreaks.com/topic/143827-php-email-and-submit-to-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.