Hi All,
I am new to this portal, hope some one will guide me with my issue, i wanted to send the data from FORM submit to update in database at the same time it shd go as email,
Any help will be appritiate
thanks
Prashant
Hi All,
I am new to this portal, hope some one will guide me with my issue, i wanted to send the data from FORM submit to update in database at the same time it shd go as email,
Any help will be appritiate
thanks
Prashant
Sending data to Email & Database on submit
<?php
require_once('common.php');
$error=array();
if(isset($_POST['email']))
{
//checking if required fields are not empty
if($_REQUEST['email'] =='')
$error[0] = "Please fill in your email ID";
if($_REQUEST['name'] =='')
$error[count($error)] = "Please fill in your name ";
if($_REQUEST['quantity'] =='')
$error[count($error)] = "Please mention the Quantity required ";
//checking if the entered email is valid
if(!preg_match('/[\w\-]+@[\w\-]+\.[a-z\.]{2,5}/',$_REQUEST['email']) )
$error[count($error)]= "Please fill in a valid email ID";
//Inserting into database if no errors are found
if(empty($error))
{
$query = "INSERT INTO `table_name` (
`name` , `company`, `email`,`mobile`,
) VALUES ('$_REQUEST[name]','$_REQUEST[company]','$_REQUEST[email]','$_REQUEST[mobile]'); ";
mysql_query($query) or die(mysql_error());
// Email to the company or as required
$from="email@address.com";
$to =" email@address.com ";
$subject = " Received ";
$message = $_REQUEST[message]; ;
mail($to, $from, $message, $subject);
header("location:sent.php?email=$_REQUEST[email]");
}
}
$display_message=implode("<br/>",$error);
// displaying the error messages if any on validating the form values
?>
Jude D’coutho
<EMAIL SNIPPED>
Hello Admin and other PHP experts..!! small question, how to send email to the email IDs, that are listed in a database, i want to sent it as "noreply(at)mydomian(dot)com" and the receipents should be in BCc. And the mail i send is a HTML Advertisement of my service. help me out please... If possible, provide me the code from Line1, i.e,
<?php
$con = mysql_connect("localhost","munna","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// YOUR GIFT SCRIPT FOR ME
mysql_close($con);
?>
the above script is not working.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.