PHP - How Do You Insert Hyparlink Into This Code Email Code?
I use this type of a code to send automatic emails from my website:
Code: [Select] $headers = ; $headers .= ; $to = ; Click here to go to Google. ", $headers); I am having hard time figuring out how to do hyperlink on words (like here). If I do something like this: Code: [Select] <a href='http://www.google.com'>here</a> it spits out that exact thing out. Thanks you for your input Similar TutorialsHi, I need to insert some code into my current form code which will check to see if a username exist and if so will display an echo message. If it does not exist will post the form (assuming everything else is filled in correctly). I have tried some code in a few places but it doesn't work correctly as I get the username message exist no matter what. I think I am inserting the code into the wrong area, so need assistance as to how to incorporate the username check code. $sql="select * from Profile where username = '$username'; $result = mysql_query( $sql, $conn ) or die( "ERR: SQL 1" ); if(mysql_num_rows($result)!=0) { process form } else { echo "That username already exist!"; } the current code of the form <?PHP //session_start(); require_once "formvalidator.php"; $show_form=true; if (!isset($_POST['Submit'])) { $human_number1 = rand(1, 12); $human_number2 = rand(1, 38); $human_answer = $human_number1 + $human_number2; $_SESSION['check_answer'] = $human_answer; } if(isset($_POST['Submit'])) { if (!isset($_SESSION['check_answer'])) { echo "<p>Error: Answer session not set</p>"; } if($_POST['math'] != $_SESSION['check_answer']) { echo "<p>You did not pass the human check.</p>"; exit(); } $validator = new FormValidator(); $validator->addValidation("FirstName","req","Please fill in FirstName"); $validator->addValidation("LastName","req","Please fill in LastName"); $validator->addValidation("UserName","req","Please fill in UserName"); $validator->addValidation("Password","req","Please fill in a Password"); $validator->addValidation("Password2","req","Please re-enter your password"); $validator->addValidation("Password2","eqelmnt=Password","Your passwords do not match!"); $validator->addValidation("email","email","The input for Email should be a valid email value"); $validator->addValidation("email","req","Please fill in Email"); $validator->addValidation("Zip","req","Please fill in your Zip Code"); $validator->addValidation("Security","req","Please fill in your Security Question"); $validator->addValidation("Security2","req","Please fill in your Security Answer"); if($validator->ValidateForm()) { $con = mysql_connect("localhost","uname","pw") or die('Could not connect: ' . mysql_error()); mysql_select_db("beatthis_beatthis") or die(mysql_error()); $FirstName=mysql_real_escape_string($_POST['FirstName']); //This value has to be the same as in the HTML form file $LastName=mysql_real_escape_string($_POST['LastName']); //This value has to be the same as in the HTML form file $UserName=mysql_real_escape_string($_POST['UserName']); //This value has to be the same as in the HTML form file $Password= md5($_POST['Password']); //This value has to be the same as in the HTML form file $Password2= md5($_POST['Password2']); //This value has to be the same as in the HTML form file $email=mysql_real_escape_string($_POST['email']); //This value has to be the same as in the HTML form file $Zip=mysql_real_escape_string($_POST['Zip']); //This value has to be the same as in the HTML form file $Birthday=mysql_real_escape_string($_POST['Birthday']); //This value has to be the same as in the HTML form file $Security=mysql_real_escape_string($_POST['Security']); //This value has to be the same as in the HTML form file $Security2=mysql_real_escape_string($_POST['Security2']); //This value has to be the same as in the HTML form file $sql="INSERT INTO Profile (`FirstName`,`LastName`,`Username`,`Password`,`Password2`,`email`,`Zip`,`Birthday`,`Security`,`Security2`) VALUES ('$FirstName','$LastName','$UserName','$Password','$Password2','$email','$Zip','$Birthday','$Security','$Security2')"; //echo $sql; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } else{ mail('email@gmail.com','A profile has been submitted!',$FirstName.' has submitted their profile',$body); echo "<h3>Your profile information has been submitted successfully.</h3>"; } mysql_close($con); $show_form=false; } else { echo "<h3 class='ErrorTitle'>Validation Errors:</h3>"; $error_hash = $validator->GetErrors(); foreach($error_hash as $inpname => $inp_err) { echo "<p class='errors'>$inpname : $inp_err</p>\n"; } } } if(true == $show_form) { ?> hi, this piece of code is not working, is it ok? Code: [Select] $query1 = "SELECT * FROM members_copy WHERE RSUSER = '".$RSUSER."' AND RSPASS = '".$RSPASS."'"; $result1 = mysql_query($query1); $row1 = mysql_fetch_array($result1); $_SESSION['USERID']=$row1['USERID']; $_SESSION['rsTown']=$row1['rsTown']; $_SESSION['RSEMAIL']=$row1['RSEMAIL']; $_SESSION['RSUSER']=$row1['RSUSER']; $pSQL = "INSERT INTO favepub_copy (USERID,PUBID)"; $pSQL = $pSQL."SELECT ".$_SESSION['USERID'].", PUBID "; $pSQL = $pSQL."FROM pubs "; $pSQL = $pSQL."WHERE rsTown = '".$rsTown; //echo "hello world"; //echo $pSQL; //exit(); mysql_query($pSQL); I am showing Youtube videos on my site and am pulling the data in from an xml file... However this is the problem I'm having... When I pull in the video the output is working correctly until you get the image file... it's HUGE... NOT what I wanted so I set about trying to figure out how to resize the image... I have tried many things but no luck. I don't have access to the google api to change the picture size sooooo... I"m trying to do so within the php I do have..here is what I have... $videos[$i]['img'] = $matches[0]; That output shows the HUGE picture.... Here is what I've tried to do ... $videos[$i]['img'] = $matches[0] "width=100px height=100px"; That is a no go... it crashes the site and I know it's a quote thing.. I do know that the first example outputs the image... or puts the img in a string to be output according to the video, I understand that. How do I resize the img to make it smaller? Here is the entire code for the parsing of the xml file.... <head> <link rel="stylesheet" href="modules/mod_jusertube/css/mediaboxAdvBlack21.css" type="text/css" media="screen" /> <script src="modules/mod_jusertube/js/mootools-more-1.3.js" type="text/javascript"></script> <script src="modules/mod_jusertube/js/mediaboxAdv-1.4.0.js" type="text/javascript"></script> <script src="modules/mod_jusertube/js/an7effects-1.5.5.js" type="text/javascript"></script> </head> <?php /** * @Copyright Copyright (C) 2010- Md. Afzal Hossain * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html **/ /* This file is part of mod_lcc. mod_lcc is free softwa you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. mod_lcc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with mod_lcc. If not, see <http://www.gnu.org/licenses/>. */ // no direct access defined('_JEXEC') or die('Restricted access'); class FeedReader { var $cachetime; var $filepath; function __construct($updatefeed = 300){ $this->cachetime = $updatefeed; $this->filepath = dirname(__FILE__).DS; } function get_youtube_top($youtubeuser,$totalvid){ $filename = $this->filepath.'youtube_'.$youtubeuser.'.xml'; if(is_file($filename)){ $utime = filemtime($filename); $chtime = time() - 60*$this->cachetime; if($utime>$chtime) $updated = true; else $updated = false; } else{ $updated = false; } if(!$updated){ $link="http://gdata.youtube.com/feeds/base/users/$youtubeuser/uploads?alt=rss"; $ch = curl_init($link); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 0); $data = curl_exec($ch); curl_close($ch); if(strlen($data)>100) file_put_contents($filename,$data); } if(is_file($filename)){ $data = file_get_contents($filename); } else{ return false; } $rss = new SimpleXMLElement($data); $i = 0; $videos = array(); foreach($rss->channel->item as $item){ //$guid_split = explode('/',$item->guid); //$videos[$i]['id'] = $guid_split[6]; $videos[$i]['title'] = (string) $item->title; $videos[$i]['link'] = (string) $item->link; //$videos[$i]['embed'] = '<object width="100" height="125"><param name="movie" value="http://www.youtube.com/watch/'.$guid_split[6].'"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/'.$guid_split[6].'" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="385"></object>'; $description = (string) $item->description; $matches = array(); preg_match("/<img[^<>]+>/",$description,$matches); $videos[$i]['img'] = $matches[0]; $i++; if($i>=$totalvid) break; } return $videos; } } Thanks guys!! Again! i have this code... and i want to make it more dynamic.... Code: [Select] <?php $content = $content[1].$content[2].$content[3].$content[4].$content[5].$content[6].$content[7].$content[8].$content[9].$content[10].$content[11].$content[12] .$content[13].$content[14].$content[15].$content[16] .$content[17].$content[18].$content[19].$content[20].$content[21].$content[22].$content[23].$content[24]; $sql = mysql_query ("insert into database (content) values ('$content')") or die(mysql_error()); ?> for example... instead content[1]. content[2]. content[3] ...etc... i want something like this....... $content = $content[from 1 to 24]; or $content = $content[from 1 to 777]; any solutions? My application just broke about 2 hours ago and for the life of me I don't know what I did to it?! (I was coding a different file, and when I tried to run the main - unrelated index.php - things stopped working?!) Here is a snippet of the suspect code... if ($rows == 0){ // Email and Username are available. // Add User to the database. $q = "INSERT INTO users(username, email, pass, first_name, last_name, date_expires) VALUES('$u', '$e', '" . get_password_hash($p) . "', '$fn', '$ln', ADDDATE(NOW()), INTERVAL 1 MONTH))"; $r = mysqli_query($dbc, $q); When I step through my code in NetBeans, the INSERT is failing and I don't know why because I haven't touched this code since this morning and it was working all day... Please help! TomTees Hello, I am trying to get a news script to work, but I can't get it to insert anything into the database. I cannot figure it out for the life of me. Code: (newsupdate.php) [Select] <form name="shout" action="post.php" method="post"> <p><b>Name:</b><br/><input type="text" name="name" size="15"/></p> <p><b>Message</b>:<br/> <textarea wrap="physical" name="message" rows="3" cols="25">News goes here! </textarea></p> <p><input type="submit" value="Shout now!"/> <input type="reset" value="Clear"/></p> </form> Code: (post.php) [Select] <? $name = $_POST["name"]; $message = $_POST["message"]; include("dbconnect.php"); $date = date("M j y"); $menu = MYSQL_QUERY("INSERT INTO adminnews (id,name,date,message)". "VALUES ('NULL', '$name', '$date', '$message')"); echo("Shout-out added! You will be redirected to the main page shortly. If you are not, click <a href='index.php'>here</a>."); ?> dbconnect.php is just the configuration for connecting to the database, and I have checked that all ready. A log-in script uses it just fine. Hi, I'm trying to copy some values from a table called "member" to a table called "report" when new members submit a php application form. I can't see what's wrong with it. I have attached screenshots of the 2 tables and their structure. Any help would be much appreciated. global $conn,$dal; $customerID = mysql_insert_id(); $strSQLInsert = "insert into report (appID, memberID, select_agent, agent_details, first_name, last_name, street_address, suburb, postcode) values (".$ID.", ".$ID.", '".$values["select_agent"]."', '".$values["agent_details"]."', '".$values["first_name"]."', '".$values["last_name"]."', '".$values["street_address"]."', '".$values["suburb"]."', '".$values["postcode"]."')"; db_exec($strSQLInsert,$conn); [attachment deleted by admin] Hello, i have this php code. Its for sms insertion of links in to table <table border="1"> <?PHP $db_user = 'user'; $db_pass = 'pass'; $db_name = 'name'; $db_host = 'localhost'; if(mysql_connect($db_host,$db_user,$db_pass)) { mysql_select_db($db_name); mysql_query("CREATE TABLE IF NOT EXISTS smsads(id bigint unsigned primary key auto_increment, link varchar(255), fromnum varchar(60))"); $res = mysql_query("SELECT * FROM smsads ORDER BY id DESC LIMIT 10"); while($row = mysql_fetch_object($res)) { $http_link = $row->link; if(strstr($http_link, 'http') === FALSE) $http_link = 'http://'.$http_link; echo "<tr><td><a href=\"{$http_link}\" target=\"_blank\">{$row->link}</a></td></tr>"; } } ?> </table> The problem is that i use tpl files for the visual part and all my other tables are in tpl. How can i insert the table above in my tpl file, whitout loosing its functions? Hello everybody, I can't seem to figure out why this insert code isn't working. I'm trying to create a database of US zip codes. I created this user interface (form) with nothing but a submit button to execute the insert query <div id="right_content" class=""> <h3> Insert Zips </h3> <form action = "insertzip1.php" method = "post"> <input type = "submit" name = "submit" value = "submit"/> </form> </div> <!--closes right content--> Well here is the insert query which is supposed to accomplish the task. I have just included a tiny subsets of all the zipcodes (the insertzip1.php page which is the value of the action attribute of the form). <php? if (isset($_POST['submit'])) { require ('config.php'); $query = "INSERT INTO zips (zip, lat, lon, city, state, county, z_type, xaxis, yaxis, zaxis, z_primary, worldregion, country, locationtext, location, population, housingunits, income, landarea, waterarea, decommisioned, militaryrestrictioncodes, decommisionedplace) VALUES ('00501', 40.81, -73.04, 'HOLTSVILLE', 'NY', 'SUFFOLK', 'UNIQUE', 0.22, -0.72, 0.65, 'Yes', 'NA', 'US', 'Holtsville, NY', 'NA-US-NY-HOLTSVILLE', '', 0, 0, '', '', 'No', '', ''), ('00501', 40.81, -73.04, 'I R S SERVICE CENTER', 'NY', 'SUFFOLK', 'UNIQUE', 0.22, -0.72, 0.65, 'No', 'NA', 'US', 'I R S Service Center, NY', 'NA-US-NY-I R S SERVICE CENTER', '', 0, 0, '', '', 'No', '', ''), ('00544', 40.81, -73.04, 'HOLTSVILLE', 'NY', 'SUFFOLK', 'UNIQUE', 0.22, -0.72, 0.65, 'Yes', 'NA', 'US', 'Holtsville, NY', 'NA-US-NY-HOLTSVILLE', '', 0, 0, '', '', 'No', '', ''), ('00544', 40.81, -73.04, 'IRS SERVICE CENTER', 'NY', 'SUFFOLK', 'UNIQUE', 0.22, -0.72, 0.65, 'No', 'NA', 'US', 'Irs Service Center, NY', 'NA-US-NY-IRS SERVICE CENTER', '', 0, 0, '', '', 'No', '', '') "; $result = mysql_query($query); header("Location: insertzipsuccess.php"); }else{ die ("Could not insert data because" . mysql_error());} ?> The insertzipsuccess.php page is simply a page that prints out a success message if the query is successfully executed. Well when I hit the submit button, I just get redirected to a blank insertzip1.php page Can anyone show me what I'm not doing right here? PS I already created the table with fields that correspond to all the fields I'm trying insert. Friends this is a very strange problem i,m facing i made a form by which you can enter comments to a topic i get the comment title and comment topic and date and the name and e mail of the one who insert a comment according to these variables $id1=$row2['id']; echo "$id1"; //Comment poster,s name $name =strip_tags(@$_POST['coname']); //Comment title $title =strip_tags(@$_POST['comtitle']); //ment poster,s email $mail =strip_tags(@$_POST['comemail']); //comment $com =strip_tags(@$_POST['limitedtextarea']); //comment,s date $d= date("Y-m-d"); notice that i,m printing the topic id and i used the variable $id1 to get it inorder to use it to show the comments for this topic later and it shows the right id for the shown topic then i used this code to insert these variable into the database if(isset($_POST['add']) and $_POST['add']=='comm'){ $insertcomm =mysql_query("INSERT INTO comments (com_name,com_title,com_mail,comment,com_date,tid) VALUES ('$name','$title','$mail','$com','$d','$id1')") or die("comments were not inserted"); if(isset($insertcomm)){ echo "comment inserted ";} } I have a download area in my index.php. I'd like to insert a row in the connected database when a user downloads a file. Here's what I have at the start of index.php: <?php session_start(); // start of script every time. // setup a path for all of your canned php scripts $php_scripts = '/home/larry/web/test/php/'; // a folder above the web accessible tree // load the pdo connection module require $php_scripts . 'PDO_Connection_Select.php'; require $php_scripts . 'GetUserIpAddr.php'; //******************************* // Begin the script here $ip = GetUserIpAddr(); if (!$pdo = PDOConnect("foxclone")): { echo "Failed to connect to database" ; exit; } else: { $filename = NULL; $stmt = $pdo->prepare("INSERT INTO download (IP_ADDRESS, FILENAME) VALUES (?, ?)"); $stmt->execute([$ip,$filename]) ; } endif; //exit(); ?> <DOCTYPE html> Here's what my download area looks like: <?php $files = glob('download/*.iso'); $file = $files[count($files) -1]; $filename = basename($file); ?> <div class="container"> <div class="divL"> <h3>Get the "<?php echo "{$filename}";?>" file (approx. 600MB)</h3> <center> <a href="<?php echo "/{$file}";?>"><img src="images/button_get-the-app.png" alt=""></a> </center> How do I execute "$stmt->execute([$ip,$filename]) ;" when the download button is pressed? Hi,
I'm really at a loss here.
I have queried a table to get an option list, which returns what I expect but I need to then add it to some current code instead of the fixed option list presented.
The syntax is beyond me.
Please see attached.
Any pointers would be great.
Attached Files
OptionList.txt 1.61KB
7 downloads i am trying to insert data into a database with the following code <?php $first_name=$_POST['first_name']; $middle_name=$_POST['middle_name']; $last_name=$_POST['last_name']; $gender=$_POST['gender']; $file_number=$_POST['file_number']; $character=$_POST['character']; $diagnosis=$_POST['diagnosis']; $description=$_POST['description']; $day = $_POST['day']; $month = $_POST['month']; $year = $_POST['year']; $date = date("Y-m-d", mktime(0,0,0,$month, $day, $year)); $con = mysql_connect("localhost","fathersh_search","f33321rh"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("fathersh_childsearch", $con); $sql="INSERT INTO child_info (first_name,middle_name,last_name,gender,birthdate,character,diagnosis,description,file_number) VALUES ('$_POST[first_name]','$_POST[middle_name]','$_POST[last_name]','$_POST[file_number]','$_POST[gender]','$date','$_POST[character]','$_POST[diagnosis]','$_POST[description]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ?> the error i get is Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'character,diagnosis,description,file_number) VALUES ('James','Anthony','Peters',' at line 1 Code: [Select] <?php require "db/config.php"; $fname = $_POST['fname']; $lname = $_POST['lname']; $country = $_POST['country']; $state = $_POST['state']; $city = $_POST['city']; $zcode = $_POST['zcode']; $address = $_POST['address']; $ppemail = $_POST['ppemail']; $pnumber = $_POST['pnumber']; $cemail = $_POST['cemail']; $url = $_POST['url']; $price = "$5.00"; $query = "INSERT INTO custpackage1000( id, FirstName, LastName, Country, State, City, ZipCode, Address, PayPalEmail, PhoneNumber, PrimaryEmail, WebsiteURL) VALUES ( '1', '$fname', '$lname', '$country', '$state', '$city', '$zcode', '$ppemail', '$pnumber', '$cemail', '$url')"; mysql_connect($host, $user, $pass) or die("<br /><br /><h1>Fatal error. Please contact support if this persists.</h1>"); mysql_select_db($dbname); mysql_query($query) or die ("could not open db".mysql_error()); sleep(2); ?> Why won't the code insert into my database upon submission of data? What am I doing wrong? The attached code works except the email portion. This code allows a user to upload a file(s) to a network share & has a few check mark boxs for John Doe & Jane Doe. If the box for John or Jane is checked it is suppose to send them an email once submit is pressed but the email does not get sent. Can someone help me out on this? Thanks Help with PHP Email Code I am currently designing a PHP website and i have been following some useful tutorials but one that i have followed i have come unstuck with and it wont work. If anyone could help me with the code below it would be a great help. First of all we have the contact.html form Code: [Select] <html> <head> <title>Ajax Contact Form by Andrew Walsh</title> <style type="text/css"> body { margin:50px 0px; padding:0px; text-align:center; } #contactarea { width:350px; margin:0px auto; text-align:left; padding:15px; border:1px solid #333; background-color:#eee; font-weight: bold; font-family: Verdana, Arial; font-size: 12px; } #inputbox { border: 1px solid #000; width: 270; padding: 2px; font-weight: bold; font-family: Verdana, Arial; font-size: 12px; } #inputlabel { font-weight: bold; font-family: Verdana, Arial; font-size: 12px; } #textarea { border: 1px solid #000; padding: 2px; font-weight: bold; font-family: Verdana, Arial; font-size: 12px; width:330; } #submitbutton { border: 1px solid #000; background-color: #eee; } </style> <script language="javascript"> function createRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); function sendemail() { var msg = document.contactform.msg.value; var name = document.contactform.name.value; var email = document.contactform.email.value; var subject = document.contactform.subject.value; document.contactform.send.disabled=true; document.contactform.send.value='Sending....'; http.open('get', 'contact.php?msg='+msg+'&name='+name+'&subject='+subject+'&email='+email+'&action=send'); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; var update = new Array(); if(response.indexOf('|' != -1)) { update = response.split('|'); document.getElementById(update[0]).innerHTML = update[1]; } } } </script> </head> <body> <div id="contactarea"> <form name="contactform" id="contactform"> <span id="inputlabel">Name:</span> <input type="text" name="name" id="inputbox"> <span id="inputlabel">Email:</span> <input type="text" name="email" id="inputbox"> <span id="inputlabel">Subject:</span> <input type="text" name="subject" id="inputbox"> <span id="inputlabel">Message:</span> <textarea name="msg" rows="10" id="textarea"></textarea> <input type="button" value="Send Email" name="send" onclick="sendemail();" id="submitbutton"> </form> </div> </body> </html> Then we have the contact.php form <?php /* Author: Andrew Walsh Date: 30/05/2006 Codewalkers_Username: Andrew This script is a basic contact form which uses AJAX to pass the information to php, thus making the page appear to work without any refreshing or page loading time. */ $to = "mike2fast135@hotmail.com"; //This is the email address you want to send the email to $subject_prefix = ""; //Use this if you want to have a prefix before the subject if(!isset($_GET['action'])) { die("You must not access this page directly!"); //Just to stop people from visiting contact.php normally } /* Now lets trim up the input before sending it */ $name = trim($_GET['name']); //The senders name $email = trim($_GET['email']); //The senders email address $subject = trim($_GET['subject']); //The senders subject $message = trim($_GET['msg']); //The senders message mail($to,$subject,$message,"From: ".$email.""); //a very simple send echo 'contactarea|Thank you '.$name.', your email has been sent.'; //now lets update the "contactarea" div on the contact.html page. The contactarea| tell's the javascript which div to update. ?> From what i can gather the HTML form passes the information to the PHP form which then sends the information to your email address. I have changed the email address to the one that i want to use and have also tried using a different one incase it did not like the one i have chosen to use. If anyone could help with this i would really appreciate it. Thanks Posts: 1 Joined: Thu Mar 31, 2011 12:03 pm Top i have a page in my website with PHP , that do a customer comment and it send me an emails for those comments , and then send an automatic email to the customer , but my only problem is that i want the customer to receive the email as it is from the email i got my emails on , but when the customer received the email it received as my username in my host site @ hostsite.com i want to solve this please thanks. here is the code : <?php require_once('recaptchalib.php'); $errFlag=0; $showForm=1; //KEEP YOUR PRIVATE KEY HERE $privatekey = ""; // << replace this key with yours function isValidEmail($email){ return filter_var(filter_var($email, FILTER_SANITIZE_EMAIL), FILTER_VALIDATE_EMAIL); } if (isset($_POST["submit"])){ $name=$_POST['name']; $lname=$_POST['lname']; $phone=$_POST['phone']; $email=$_POST['email']; $message=$_POST['message']; if(empty($_POST)) { $errMsg[]="Please enter all the field."; } if(empty($name)) { $errMsg[]="Please enter your First Name."; } if(empty($lname)) { $errMsg[]="Please enter your Last Name."; } if(empty($phone)) { $errMsg[]="Please enter phone number."; } elseif(!is_numeric($phone)) { $errMsg[]="Please enter valid phone number."; } if(empty($email)) { $errMsg[]="Please enter an email address."; } elseif(!isValidEmail($email)) { $errMsg[]="Please enter an valid email address."; } if(empty($message)) { $errMsg[]="Please enter message."; } /* captcha validation */ $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly $errMsg[]="The CAPTCHA wasn't entered correctly. Please try it again."; } if(empty($errMsg)) { // if there is no error then send a mail $ToEmail = 'myreiki11@gmail.com'; // CHANGE YOUR EMAIL WHERE YOU WANT TO RECEIVE THE CONTACT FORM SUBMITTED BY USERS... $EmailSubject = 'Customer Comments '; $mailheader = "From: ".$email."\r\n"; $mailheader .= "Reply-To: ".$email."\r\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $MESSAGE_BODY = "Name: ".$name." ".$lname."<br>"; $MESSAGE_BODY .= "Phone: ".$phone."<br>"; $MESSAGE_BODY .= "Email: ".$email."<br>"; $MESSAGE_BODY .= "Comment: ".nl2br($message)."<br>"; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); if(mail) { $msg="Thank your for submitting the form, we will contact your shortly."; $showForm=0; mail($email, "Thank your for submitting.", $msg); } else { $msg="Some errors occured, please try again in a while."; } } else { $errFlag=1; } } ?> <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns="urn:schemas-microsoft-comfficeffice" xmlns="http://www.w3.org/TR/REC-html40"> <head> <link rel="shortcut icon" href="http://www.divineenergyhealing.co/favicon.ico"> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Customer Comments</title> <meta name="description" content="Customer Comments"> <link rel="File-List" href="reiki website/Reiki/Customer Comments_files/filelist.xml"> <base target="_self"> <!--[if !mso]> <style> v\:* { behavior: url(#default#VML) } o\:* { behavior: url(#default#VML) } .shape { behavior: url(#default#VML) } </style> <![endif]--><!--[if gte mso 9]> <xml><o:shapedefaults v:ext="edit" spidmax="1027"/> </xml><![endif]--> <style type="text/css"> /* error and success msg */ #errMsg { background-color:#febbbb; border:1px solid #d31a1c; color:#d31a1c; font-size:12px; padding:10px; margin-bottom:15px;} #successMsg { background-color:#ffffff; border:1px solid #ffffff; color:#000000; font-size:16px; padding:10px; margin-bottom:15px; margin-top:25px;} #contact_form { position: absolute; width: 888px; height: 365px; z-index: 1; left: 190px; top: 128px;} #contact_form form label { display:block;} contact_form p { margin-bottom:10px;} .auto-style1 { font-family: "Times New Roman", Times, serif; font-weight: bold; color: #FFFFFF; } </style> </head> <body link="#0000FF" vlink="#800000" alink="#FF0000"> <p> </p> <p align="left"> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p align="left"> </p> <div id="contact_form" style="left: 192px; top: 102px"> <?php if($errFlag) { echo "<div id='errMsg'>"; foreach($errMsg as $val) { echo "- "; echo $val; echo "<br />"; } echo "</div>"; } ?> <?php if($showForm){ ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" name="contact_form" method="post"> <p> <label for="name">First Name</label> <input name="name" type="text" id="name" value="<?php if (isset($_POST['name'])) echo $_POST['name']; ?>" /> </p> <p style="height: 45px"> <label for="lname">Last Name</label><input name="lname" type="text" id="lname" style="width: 148px; height: 22px" value="<?php if (isset($_POST['lname'])) echo $_POST['lname']; ?>" /> </p> <p> <label for="phone">Phone Number</label> <input name="phone" type="text" id="phone" value="<?php if (isset($_POST['phone'])) echo $_POST['phone']; ?>" /> </p> <p> <label for="email">Email Address</label> <input name="email" type="text" id="email" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /> </p> <p> <label for="message">Customer Comments</label> <textarea name="message" id="message" style="width: 247px; height: 84px" rows="999"><?php if (isset($_POST['message'])) echo $_POST['message']; ?></textarea> </p> <p> <?php //PUT YOUR PUBLIC KEY HERE $publickey = ""; // << replace this key echo recaptcha_get_html($publickey); ?> </p> <p><input name="submit" type="submit" value="Submit" /> <input name="reset" type="reset" value="Reset" /></p> </form> <?php } else { ?> <div id="successMsg" class="auto-style1">Thanks for your comments and questions we appreciate that you took the time to send us..</div> <?php }?> </div> </body> </html> Hi, I have this email code working for me: $headers1 = "From: my@email.com\r\n"; $headers1 .= "BCC: other@email.com\r\n"; $to1 = $_GET['e1'].", ". $_GET['e2'].", ". $_GET['e3'].", ". $_GET['e4']; mail($to1, " my subject line", " my message here ", $headers1); In the forms users can submit up to 4 independent email addresses (but are not required to do so) in any combination. This email from works only if email address 1 and 4 are entered. Other can be entered too, but if 1 and 4 are not there email does not go out. I sort of understand why, but I can not figure out a way around it and I do not want to split to 4 independent email codes. Any help on this one? Thanks HI everyone, I am sure this has got to be common question. Is there a way to tell if an email recipient opened an email I sent? Here is the scenario. In an application where the application sends email campaigns. So, if I send out an email to 100 people, I want to keep track of how many of them actually opened the email. I do not want to rely on a reader clicking a link, or downloading image to determine if the "read" the email, as one can still read an email without doing those things. Is there a more reliable way? Thanks Kipper |