PHP - Code To Send Web Form To Multiple Address
Hi
First time post. I have read online and there are so many different answers I do not know which to choose.
I have a form on a website which works fine as it is.
I just want to add a function that when the the visitor clicks submit they get a copy of the email as well.
This is the code I have:
<p>Please read through our terms of business below. If you are happy with them and understand them please complete your details and press the agree button. We will email confirmation of receipt</p>
<div class="content_image"> <img src="images/questionnaire.jpg" alt="" width="350" height="225" /> </div> <form id="questionnaire" method="post" action="terms-of-business-send.php" name="questionnaire"> <fieldset> <div> <label>Your Full Name:</label><br /> <input type="text" id="c_name1" name="c_name1" class="qfield clear" /> </div> <div> <label>Your Email:</label><br /> <input type="text" id="email" name="email" class="qfield clear" /> </div> <div> <label>Your Contact Tel:</label><br /> <input type="text" id="tel" name="tel" class="qfield clear" /> </div> </fieldset> <fieldset> <ol> <li> <h2>I agree I have read and understood the terms of business</h2> <input type="radio" name="q1" value="1" /> yes I agree<br /> </li> </ol> <div> </div> </fieldset> <input type="submit" value="Agree"> <input type="reset" value="Reset"> <h4 id="error">There were errors on the form, please make sure your name and email have been filled out correctly.</h4> </form> Then the send file is <?php $c_name1 = $_POST['c_name1']; $email = $_POST['email']; $tel = $_POST['tel']; $q1 = $_POST['q1']; //$to = 'enquiries@email.net'; $to = 'enquiries@cemail.net'; $subject = 'Terms of Business Completed'; $msg = "$c_name1 has completed a Terms of Business from.\n\n" . "Their email is: $email\n" . "Their contact number is: $tel\n" . "-----------------------------\n\n" . "1: $q1\n\n" . "Terms of business copy here" . "-----------------------------\n" . " END OF FORM -------\n" . "-----------------------------\n\n"; mail($to, $subject, $msg, 'From: website Terms of Business Form'); echo '<h2>Thanks for confirming our Terms of Business ' . $c_name1 . '</h2>'; ?> I kind of understand what is going on but am not proficient enough. Any help much appreciated. Rich Similar TutorialsCode: [Select] <?php $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $dropdown = $_POST['dropdown']; $formcontent=" From: $firstname \n Surname: $lastname \n Email: $email \n Dropdown: $dropdown"; $recipient = "martin@sittingspiritually.co.uk, siobhan@sittingspiritually.co.uk"; $subject = "Newsletter Sign Up"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); if ( mail($recipient, $subject, $formcontent, $mailheader) ){ header('Location: http://www.sittingspiritually.co.uk/thankyou.php'); } else { die ("error"); } ?> I have recently created a small snippet of php code for posting mail and it's sweet apart from 1 thing. I have two email addresses in the recipient section. It only sends to the last name in the list. Is this because i have written recipient? Should it be recipients? I need this mail to be delivered to both of the email addresses. I'm sure it's simple for someone with expert knowledge. Thanks in advance for any help. I have made a shopping cart where I can add items from my sql table. But I dont know how to send the table to my email. this is my cart.php Can someone give me some tips? Thanks in advance. you can also check it out on http://fhcs.be/cart-demo3/ <?php // Include MySQL class require_once('inc/mysql.class.php'); // Include database connection require_once('inc/global.inc.php'); // Include functions require_once('inc/functions.inc.php'); // Start the session session_start(); // Process actions $cart = $_SESSION['cart']; $action = $_GET['action']; switch ($action) { case 'add': if ($cart) { $cart .= ','.$_GET['id']; } else { $cart = $_GET['id']; } break; case 'delete': if ($cart) { $items = explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($_GET['id'] != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } $cart = $newcart; } break; case 'update': if ($cart) { $newcart = ''; foreach ($_POST as $key=>$value) { if (stristr($key,'qty')) { $id = str_replace('qty','',$key); $items = ($newcart != '') ? explode(',',$newcart) : explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($id != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } for ($i=1;$i<=$value;$i++) { if ($newcart != '') { $newcart .= ','.$id; } else { $newcart = $id; } } } } } $cart = $newcart; break; } $_SESSION['cart'] = $cart; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>PHP Shopping Cart Demo &#0183; Cart</title> <link rel="stylesheet" href="css/styles.css" /> </head> <body> <div id="shoppingcart"> <h1>Your Shopping Cart</h1> <?php echo writeShoppingCart(); ?> </div> <div id="contents"> <h1>Please check quantities...</h1> <?php echo showCart(); ?> <p><a href="index.php">Back to bookshop...</a></p> </div> </body> </html> Hey guys, how do I send checkbox variables to my e-mail address once a user has checked it on the html form. Here is my html form: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Form</title> <script type="text/javascript"> //email form validation function everif(str) { var at="@" var punct="." var lat=str.indexOf(at) var lstr=str.length var lpunct=str.indexOf(punct) if (str.indexOf(at)==-1){ alert("Valid email must be entered") return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ alert("Valid email must be entered") return false } if (str.indexOf(punct)==-1 || str.indexOf(punct)==0 || str.indexOf(punct)==lstr){ alert("Valid email must be entered") return false } if (str.indexOf(at,(lat+1))!=-1){ alert("Valid email must be entered") return false } if (str.substring(lat-1,lat)==punct || str.substring(lat+1,lat+2)==punct){ alert("Valid email must be entered") return false } if (str.indexOf(punct,(lat+2))==-1){ alert("Valid email must be entered") return false } if (str.indexOf(" ")!=-1){ alert("Valid email must be entered") return false } return true } function evalid(){ var emailID=document.contact_form.mail if (everif(emailID.value)==false){ emailID.focus() return false } //empty field validation var naam=document.contact_form.naam if ((naam.value==null)||(naam.value=="")){ alert("Fields marqued with * must be entered") naam.focus() return false } var telefoon=document.contact_form.telefoon if ((telefoon.value==null)||(telefoon.value=="")){ alert("Fields marqued with * must be entered") telefoon.focus() return false } var branche=document.contact_form.branche if ((branche.value==null)||(branche.value=="")){ alert("Fields marqued with * must be entered") branche.focus() return false } return true } </script> </head> <body> <form name="contact_form" method="post" id="contactform" action="doeactie.php" onSubmit="return evalid()"> <table border="0"> <tr> <td><label for="bedrijfsnaam">Company name</label></td> <td colspan="2"><input name="bedrijfsnaam" type="text" class="text" size="30" /></td> </tr><tr> <td><label for="naam">Name *</label></td> <td colspan="2"><input name="naam" type="text" class="text" size="30" /></td> </tr><tr> <td><label for="mail">E-mail *</label></td> <td colspan="2"><input type="text" name="mail" class="text" size="30" /></td> </tr><tr> <td><label for="adres">Address</label></td> <td colspan="2"><input name="adres" type="text" class="text" size="30" /></td> </tr><tr> <td><label for="plaatsnaam">City</label></td> <td colspan="2"><input name="plaatsnaam" type="text" class="text" size="30" /></td> </tr><tr> <td><label for="postcode">Zip</label></td> <td colspan="2"><input type="text" name="postcode" class="text" size="10" /></td> </tr><tr> <td><label for="branche">Niche *</label></td> <td colspan="2"><input name="branche" type="text" class="text" size="30" /></td> </tr><tr> <td><label for="telefoon">Phone *</label></td> <td colspan="2"><input name="telefoon" class="text" type="text" size="30" /></td> </tr><tr> <td><label for="bericht">Question or Comment</label></td> <td colspan="2"><textarea name="message" class="text" onkeyup="return limitarelungime(this, 255)" cols="35" rows="5"></textarea></td> </tr> </table> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td></td> <td height="25"></td> </tr> <tr> <td></td> <td height="30" valign="top"><font face="arial" size="2"><b>I would also like to receive information about :</b></font></td> </tr> <tr> <td><input type="checkbox" name="emailmarketing" id="emailmarketing" value="emailmarketing" /></td> <td height="25"><font face="arial" size="2">E-mail Campaign</font></td> </tr> <tr> <td><input type="checkbox" name="zoekmachopt" id="zoekmachopt" value="zoekmachopt" /></td> <td height="25"><font face="arial" size="2">SEO</font></td> </tr> <tr> <td><input type="checkbox" name="socialmedia" id="id" value="socialmedia" /></td> <td height="25"><font face="arial" size="2">Social Media</font></td> </tr> <tr> <td><input type="checkbox" name="videomarketing" id="videomarketing" value="videomarketing" /></td> <td height="25"><font face="arial" size="2">Video Marketing</font></td> </tr> <tr> <td><input type="checkbox" name="webshop" id="webshop" value="webshop" /></td> <td height="25"><font face="arial" size="2">Webshop</font></td> </tr> <tr> <td><input type="checkbox" name="cms" id="cms" value="cms" /></td> <td height="25"><font face="arial" size="2">Content Management System</font></td> </tr> <tr> <td><input type="checkbox" name="grafisch" id="grafisch" value="grafisch" /></td> <td height="25"><font face="arial" size="2">Graphic Design</font></td> </tr> <tr> <td></td> <td align="left"><br /><input type="submit" name="Submit" value="Send"></td> <td align="right"></td> </tr> </table> </form> </body> </html> and this is the PHP script that processes this. Everything works except for the checkbox part. <?php session_start(); if(isset($_POST['Submit'])) { $youremail = 'blabla@gmail.com'; $fromsubject = 'Request from form'; $bedrijfsnaam = $_POST['bedrijfsnaam']; $naam = $_POST['naam']; $mail = $_POST['mail']; $adres = $_POST['adres']; $plaatsnaam = $_POST['plaatsnaam']; $postcode = $_POST['postcode']; $branche = $_POST['branche']; $telefoon = $_POST['telefoon']; $message = $_POST['message']; $to = $youremail; $mailsubject = 'Bericht ontvangen van'.$fromsubject.' Actie Pagina'; $body = $fromsubject.' Bedrijfsnaam: '.$bedrijfsnaam.' Naam Contact Persoon: '.$naam.' E-mail: '.$mail.' Adres: '.$adres.' Plaatsnaam: '.$plaatsnaam.' Postcode: '.$postcode.' Branche: '.$branche.' Telefoonnummer: '.$telefoon.' vraag of Wens: '.$message.' |---------End Message----------|'; echo "thank you for your request we will contact you asap."; mail($to, $subject, $body); } else { echo "Error Please <a href='form.html'>try again</a>"; } ?> Any help would be great! Thanks guys I'm trying to after submission
1. create a csv
2. insert record into db
3. send email that's created in form submission - $msg.
4. send email with attachment to only the email I specify (if possible)
if not attach it to the email that's created at submission.
I've search and search and found different methods but doesn't work with my code.
I kept 3 lines at the top but can't get them to work ... either I don't get an email after submission or don't get an attachement.
Can some one help?
<?php $random_hash = md5(date('r', time())); $csvString = "..."; // your entire csv as a string $attachment = chunk_split(base64_encode($csvString)); $to = "email@email.com"; if(isset($_POST['submit'])) { // VALIDATION if(empty($_POST['firstName'])) { "First Name Required"; } if(empty($_POST['lastName'])) { "Last Name Required"; } if(empty($error)) { $to = "$to"; $subject = 'The Form'; $headers = "MIME-Version: 1.0 \r\n"; $headers .= "Content-Type: text/html; \r\n" ; $msg .="<html> <head></head> <body> <table width='100%' cellspacing='0' border='0' cellpadding='0'> <tr><td> <table width='100%' cellspacing='0' border='0' cellpadding='0'> <tr><td>This is the email sent.</td></tr> </table> </body> </html>"; include('con.php'); $con = mysqli_connect($host,$user,$pass,$dbName); if (!$con) { die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,"thetable"); $firstName = mysqli_real_escape_string($con, $_POST['firstName']); $lastName = mysqli_real_escape_string($con, $_POST['lastName']); $sql = "SELECT * FROM thetable WHERE `firstName` = '{$firstName}' OR `lastName` = '{$lastName}'"; $result = mysqli_query($con,$sql); if(($result->num_rows)>= 1) { $theerror = "You exist"; } else { $sql="INSERT INTO thetable(firstName, lastName) VALUES ('$_POST[firstName]','$_POST[lastName]'"; $success = "Sent ... Insert it!!!"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } $result = @mail($to, $subject, $msg, $headers); } mysqli_close($con); { } } } ?> Edited by barkly, 27 October 2014 - 02:59 PM. I have a page that adds name and date of birth of an actor. <input type='text' id='name' name='name' value=''/> <input type='text' id='dob' name='dob' value=''/> But I made a loop that enables the user to add multiple actor information at once, so the page will actually look like this. (if you can imagine how it would look on a website with these php codes) <input type='text' id='name' name='name' value=''/> <input type='text' id='dob' name='dob' value=''/> <input type='text' id='name' name='name' value=''/> <input type='text' id='dob' name='dob' value=''/> <input type='text' id='name' name='name' value=''/> <input type='text' id='dob' name='dob' value=''/> <input type="submit" Value="Add"/> How do I send all 3 of these actor information into my saving page instead of just 1 and how do I save all 3 in that saving page? Basically I have successfully found a function that can send email with attachment. However wasn't able to send multiple attachments. I tried sending two attachments manually, but only the second was successfully attached. Can someone look through the code below and point out my mistake. Thank you in advance.... <?php if(isset($_POST['send'])) { $fileatt_one = $_FILES['attachment']['tmp_name'][0]; $fileatt_type_one = "application/octet-stream"; // File Type $fileatt_name_one = $_FILES['attachment']['name'][0]; // Filename that will be used for the file as the attachment $fileatt_two = $_FILES['attachment']['tmp_name'][1]; $fileatt_type_two = "application/octet-stream"; // File Type $fileatt_name_two = $_FILES['attachment']['name'][1]; // Filename that will be used for the file as the attachment $email_from = "a@gmail.com"; // Who the email is from $email_subject = "Test"; // The Subject of the email $email_txt = "Testing 123"; // Message that the email has in it $email_to = "a@gmail.com"; // Who the email is too $headers = "From: ".$email_from; $file_one = fopen($fileatt_one,'rb'); $data_one = fread($file_one,filesize($fileatt_one)); fclose($file_one); $file_two = fopen($fileatt_two,'rb'); $data_two = fread($file_two,filesize($fileatt_two)); fclose($file_two); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $data_one = chunk_split(base64_encode($data_one)); $data_two = chunk_split(base64_encode($data_two)); $headers .= "\nMIME-Version: 1.0\n" ."Content-Type: multipart/mixed;\n" ." boundary=\"{$mime_boundary}\""; $email_message .= "This is a multi-part message in MIME format.\n\n" ."--{$mime_boundary}\n" ."Content-Type:text/html; charset=\"iso-8859-1\"\n" ."Content-Transfer-Encoding: 7bit\n\n" .$email_txt . "\n\n"; $email_message .= "--{$mime_boundary}\n" ."Content-Type: {$fileatt_type_one};\n" ." name=\"{$fileatt_name_one}\"\n" ."Content-Transfer-Encoding: base64\n\n" .$data_one . "\n\n" ."--{$mime_boundary}--\n"; $email_message .= "--{$mime_boundary}\n" ."Content-Type: {$fileatt_type_two};\n" ." name=\"{$fileatt_name_two}\"\n" ."Content-Transfer-Encoding: base64\n\n" .$data_two . "\n\n" ."--{$mime_boundary}--\n"; $ok = @mail($email_to, $email_subject, $email_message, $headers); if($ok) { echo "<font face=verdana size=2>The file was successfully sent!</font>"; } else { die("Sorry but the email could not be sent. Please go back and try again!"); } } ?> <form enctype="multipart/form-data" name="send" method="post" action="<?=$_SERVER['PHP_SELF']?>"> <input type="file" name="attachment[]" size="50" /> <input type="file" name="attachment[]" size="50" /> <input type="submit" name="send" value="Submit"> </form> I have a HTML form with a drop down list, which has my entire buyers list populated from the database. In addition to that, I have an option on the top of the drop down such as :
<select name="sms_buyer"> <option value="alll">ALL</option> <?php require_once '../model/notifications.php'; @$result2= Notifications::getAllBuyers(); while($value2=mysql_fetch_assoc($result2)){ ?> <option value="<?php echo $value2['buyer_code']; ?>"> <?php echo $value2['buyer_name'] ?> </option> <?php } ?> </select>In the Controller I have the following code segment: function sendNotificationSMS(){ $sms_buyer=$_REQUEST['sms_buyer']; $sms_message=$_REQUEST['sms_message']; $sender='MY CLIENT'; $url='http://localhost:9333/ozeki?'; $url.="action=sendMessage"; $url.="&login=admin"; $url.="&password=abc123"; $obj=new Notifications(); if($sms_buyer=='alll'){ require_once '../model/notifications.php'; $obj=new Notifications(); $result=$obj->getAllBuyers(); while($value=mysql_fetch_assoc($result)){ $rec[]=$value['tel_no']; } foreach ($rec as $recepient) { $url.="&recepient=".urlencode($recepient); } } else{ $res=$obj->getBuyerTelNo($sms_buyer); $sms=mysql_fetch_assoc($res); $recepient=$sms['tel_no']; $url.="&recepient=".urlencode($recepient); } $message=$sms_message; $message.=' Thank You.'; $url.="&messageData=".urlencode($message); $url.="&sender=".urlencode($sender); file($url); header("location:../view/send_notifications.php?s=3#sent"); }If I type print_r($url), the output which I am intending is not appearing... Sending SMS to a single recepient is fine. The problem is sending sms to multiple recepients. Any help is appreciated. Thanks. This will only send 1 goggles information into the database but I have a "adding" page that can actually add more than 1 goggles at once. I have no idea how to go about saving multiple goggle's information using array or loop. $name= $_POST['goggles_name']; $price = $_POST['goggles_price']; $des = $_POST['goggles_description']; $file = $_FILES['goggles_image']['name']; $chkbox = $_POST['upload']; $id = $_POST['goggles_id']; $query = "UPDATE goggles SET goggles_name = '$name' , goggles_price = '$price' ,goggles_description = '$des' WHERE goggles_id ='".$id."' "; $result = mysqli_query($link, $query) or die(mysqli_error($link)); Hello, I am new in PHP and I want a script for sending multiple emails using the php and i am calling that email address from database.I also want to change the status field from database from No to Yes once I send the particular emails. How to do that? I need a urgent help Following is my code for calling the email address <? mysql_connect("localhost","root","123") or die(mysql_error()); // my database connection mysql_select_db("localacct") or die(mysql_error()); $sql = "SELECT email FROM company where status='No'"; $res = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($res) ) { $area .= $row['email']. ", "; } // read the list of emails from the file. $email_list = explode(',', $area); // count how many emails there are. $total_emails = count($email_list); // go through the list and trim off the newline character. for ($counter=0; $counter<$total_emails; $counter++) { $email_list[$counter] = trim($email_list[$counter]); } $to = $email_list; //echo $to; $t0 = ""; $subject = "Test email"; $message = wordwrap($message, 100); $from = "my email address"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: $from"; mail($to,$subject,$message,$headers); if ($count % 10 == 0) { sleep(5); // this will wait 5 secs every 10 emails sent, and then continue the while loop } $count++; } ?> Many Thanks in advance. i want to send email to multiple user.this is my code: How do I send multiple headers with this code? Code: [Select] <?php $postdata = http_build_query( array( 'var1' => 'some content', 'var2' => 'doh' ) ); $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); $result = file_get_contents('http://example.com/submit.php', false, $context); ?> *this header: Code: [Select] User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16 Dear all, Hopefully someone can help me out with this. I have a HTML form wich contains basic textfields en checkboxes. Beyond that i have a row with some dropdowns, but one of these fields in the row is a file field. Also, the visitor is able to add a new row, when the user clicks add row, a new row with the same fields including a new file field appears. This can be done as much as the user likes. The fiel field is optional though, it doesn't need to be filled. All my textfields, checkboxes and dropdowns are coming through email nicely. Only thing that isn't coming my way are the files i attach. My form (stripped but functional) can be seen here http://www.multisearch.info/test/form_test.html For the file fields i take it you need an array wich i have put in the form Code: [Select] <input type="file" name="fileupload[]"> In my PHP wich handles the form i have this wich should handle the images, but this is not working Code: [Select] if(isset($_POST['submit'])) { for($i=0;$i<count($_FILES['fileupload']);$i++) { print $_FILES['fileupload']['name'][$i]."<br />"; } } I hope someone sees something i am missing. Kind regards, Jeroen I am trying to send an e-mail message from a form, to each person in a MySQL database. In some cases, but not all, there are multiple e-mail address in the recordset. Each one should receive the same message addressed to them by name (FirstName and LastName) and e-mail address. I have tried "CONCAT_WS(' ', emailtest.Pri_EmailAddress, emailtest.Sec_EmailAddress, emailtest.Tri_EmailAddress) AS EmailTo" but it seems the relay account is rejecting the message if more than one address is in the EmailTo result. Any ideas or scripts that can do this would be appreciated. Thank you in advance for your help. so i've been trying to figure this out for a long time already, but still don't get it how does this "get_ip" thing turns out inside the email in the end? https://stackoverflow.com/questions/51067389/how-to-get-ip-address-from-html-form-using-php
and how can you use the "<?php echo $ip ?>" code inside an html form in the first place if it is only html and not even php at all? (aka the ¤value="<?php echo $ip;?>"¤ part doesnt even work at all and only displays the same exact code instead of the ip...) Hi all, What I am trying to achieve is, I thought quite simple! Basically, a user signs up and chooses a package, form is submitted, details added to the database, email sent to customer, then I want to direct them to a paypal payment screen, this is where I am having issues! Is their any way in php to submit a form without user interaction? Here is my code for the form process page Code: [Select] <?php include('config.php'); require('scripts/class.phpmailer.php'); $package = $_POST['select1']; $name = $_POST['name']; $email = $_POST['email']; $password = md5($_POST['password']); $domain = $_POST['domain']; $a_username = $_POST['a_username']; $a_password = $_POST['a_password']; $query=mysql_query("INSERT INTO orders (package, name, email, password, domain, a_username, a_password) VALUES ('$package', '$name', '$email', '$password', '$domain', '$a_username', '$a_password')"); if (!$query) { echo "fail<br>"; echo mysql_error(); } else { $id = mysql_insert_id(); $query1=mysql_query("INSERT INTO customers (id, name, email, password) values ('$id', '$name', '$email', '$password')"); if (!$query1) { echo "fail<br>"; echo mysql_error(); } if($package=="Reseller Hosting") { //email stuff here - all works - just cutting it to keep the code short if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } ?> <form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick-subscriptions"> <input type="hidden" name="business" value="subscription@jollyhosting.com"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="item_name" value="Jolly Hosting Reseller Packages"> <input type="hidden" name="no_shipping" value="1"> <!--1st month --> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="a3" value="3.00"> <input type="hidden" name="p3" value="1"> <input type="hidden" name="t3" value="M"> <input type="hidden" name="src" value="1"> <input type="hidden" name="sra" value="1"> </form>'; <?php } //last } //end ?> Hello - I am very new to PHP. I have a simple form that uses gmail SMTP. The form works, but the sender always comes across as the email address from the gmail SMTP account. We need the sender to be the email address filled in on the form.
Here is the form:
Here is the PHP to send the form: <?php
$headers = array(
$smtp = Mail::factory('smtp', array(
if (PEAR::isError($mail)) { ?> How can I get the email to come from the address that's filled in on the form? I would be very grateful for any help...thank you so much!! Hi guys, Trying to ge this to work: function checkEmail($useremail) { if (!preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+( [a-zA-Z0-9\._-] +)+$/" , $useremail)) { return false; $error = '<div id="blackText"><p>Sorry! Please check your email address and try again!<p><p><a href="forumsSignUp.php">Back</a></p></div>'; } return true; //PASSWORD AND OTHER VALIDATION STUFF, blah blah blah } But its just not. Everything works fine if I remove this though. Can anyone suggest an alternative to email address validation? Thanks! I run a small taxi company and use a php form generated user enquiry at the following url http://www.brightonairportcabs.co.uk/bookingform.html. i would like to capture the ip address of the user of my form. I have read lots of ways of doing it but do not understand where to put the code. i have a processor.php file and the webform itself, Please can someone explain how i would go about getting the user ip to stop some spam that i am getting. This is an example of the email i get through from a user submitting the form. Online Booking: Passenger Booking Name: ------ Email: example@email isp Telephone: ----- ------ No of Adults: 2 No of Children: Field question 1: Journey Type: Single-One Way Vehicle Type: 1-4 Passenger, 2-3 Cases + Hand Luggage I wish to be picked up from: Home Address I wish to be dropped at: Heathrow Airport Journey Date 1: 12/24/2011 Journey Date 2: Any Comments, Collection Address, Collection Time, etc: Collection Address: Journey Collection Time: 11am hopefully you can help in easy instructions, please let me know if you need any other information such as the coding from the form itself. many thanks in anticipation Merry Christmas to all users and i am glad i have come across the forum, i will be a regular visitor but cannot probably input any help, although you never know. |