PHP - Newby Form To Email In Iframe Using Drupal
hmmmm my last post got deleted due to my naughty url:-(
Anyway its not spam :-( hear is my real problem. I HAVE this form in a iframe in a drupal site.....I followed many tutorials but it seems fine? It keeps downloading the actual php file instead of posting to my email? form code/////////////// <form action="EnquirySend.php" method="post" enctype="application/x-www-form-urlencoded" name="Enquiry_Form" target="_self" id="Enquiry_Form"> <div class="demo"> <div id="Col1"> <p>Date Departing:</p> <p>Date Returning</p> <p>Name<span style="font-size: 16px; "><span style="color: rgb(255, 0, 0); ">*</span></span> : </p> <p>Phone<span style="font-size: 16px; "><span style="color: rgb(255, 0, 0); ">*</span></span> : </p> <p>Email:<span style="font-size: 16px; "><span style="color: rgb(255, 0, 0); ">*</span></span> : </p> <input name="button" type="submit" class="demo" id="button" value="Submit your Enquiry"> </div> <div id="fieldsAline"> <input name="departing_Date" type="text" id="departingDate"></p> <p> <input type="text" id="returnDate"></p> <p> <input maxlength="20" name="name" size="20" style="cursor: default; " type="text" /></p> <p> <input maxlength="20" name="phone" size="20" style="cursor: default; " type="text" /></p> <p> <input maxlength="30" name="email" size="20" style="cursor: default; " type="text" /></p> </div> <p><div id="Col2"> <div id="topCol2"><p>Number Travelling: <span style="font-size: 16px; "><span style="color: rgb(255, 0, 0); ">*</span> <input maxlength="2" name="number" size="3" type="text" value="1" /> PostCode :<input name="postcode" type="text" id="postcode" size="5" maxlength="5"> </p> <p>Can we help you with any extras?</p> <p> <textarea name="extras" id="extras" cols="45" rows="3">Are you interested in 5 star accommodation? </textarea> </p> <p> Which Holiday Package are you interested in <span style="font-size: 16px; "><span style="color: rgb(255, 0, 0); ">*</span></span> ? <br><br> <label> <input type="radio" name="package" value="radio" id="manila"> <span style="color:#0CF">Manila</span></label> <label> <input type="radio" name="package" value="radio" id="manila_boracay"> <span style="color:#0CF">Manila & Boacay</span></label> <br> <label> <input type="radio" name="package" value="radio" id="Manila_angeles"> <span style="color:#0CF">Manila & Angeles</span></label> <label> <input type="radio" name="package" value="radio" id="Manila_Cebu"> <span style="color:#0CF">Manila & Cebu</span></label> <br> <br><br> </p></div></div></div> </form> HERE IS THE RESPONDER PHP FILE CODE/////////// <?php //--------------------------Set these paramaters-------------------------- // Subject of email sent to you. $subject = 'Enquiry_Form '; // Your email address. This is where the form information will be sent. $emailadd = 'sales@hotasiantour.com'; // Where to redirect after form is processed. $url = 'www.hotasiantour.com'; $departing_Date = $_REQUEST['departingDate'] ; $returning_Date = $_REQUEST['returningDate'] ; $Name = $_REQUEST['name'] ; $Phone = $_REQUEST['phone'] ; $Email = $_REQUEST['email'] ; $Number_comming = $_REQUEST['number'] ; $postcode = $_REQUEST['postcode'] ; $Any_extras = $_REQUEST['extras'] ; $holiday_package = $_REQUEST ['package'] ; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty. $req = '0'; // --------------------------Do not edit below this line-------------------------- $text = "Results from form:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 20) {echo "Name of form element $key cannot be longer than 20 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } mail($emailadd, $subject, $text, 'From: '.$emailadd.''); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; // -----------------------auto responder-------------------------- $responseSubject = "Your request has been received"; $responseMessage = "Hello,\n\nThanks for submitting your request. One of our agents will be in contact with you shortly.\n\nKind regards,\nYour Company"; $responseFromName = "Hot Asian Tours"; $responseFromEmail = "sales@hotasiantour.com"; mail($fromEmail, $responseSubject, $responseMessage, "From: ".$responseFromName." <".$responseFromEmail.">"); ?> Similar TutorialsHello, I am working with a SMTP class to send an email. It's all working perfectly fine, but when the email is received (sent from the online form), and I open my email and click reply, there are two email addresses. The correct one (which I entered when I sent the email), and my ftp username for the site?? I've got three files that could effect this, but I was unable to locate any problems: mailer.php ( smtp send mail class) mail.php ( submission data: title, subject, etc. ) contact_form.php ( form for submission ) I am only including the file which I think is applicable (mail.php), but let me know if you would also like to see the mailer.php class. Current output: reply-to ftpusername@domainname.com, correct_from_email@fromemail.com mail.php: <?php set_time_limit(120); function sendHTMLmail($from, $to, $subject, $message) { $message = wordwrap($message, 70); // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= "From: $from\r\n"; // Mail it mail($to, $subject, $message, $headers); } function sendHTMLmail2($fromid, $to, $subject, $message) { echo $fromid; echo $to; echo $subject; echo $message; include_once("mailer.php"); $mail = new PHPMailer(); $mail->IsMail(); // SMTP servers $mail->Host = "localhost"; $mail->From = $fromid; $mail->FromName = $fromid; $mail->IsHTML(true); $mail->AddAddress($to, $to); $mail->Subject = $subject; $mail->Body = $message; $mail->AltBody = "Please enable HTML to read this"; $mail->Send(); exit; } function isValidEmail($email) { return eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$", $email); } class smtp_mail { var $host; var $port = 25; var $user; var $pass; var $debug = false; var $conn; var $result_str; var $charset = "utf-8"; var $in; var $from_r; //mail format 0=normal 1=html var $mailformat = 0; function smtp_mail($host, $port, $user, $pass, $debug = false) { $this->host = $host; $this->port = $port; $this->user = base64_encode($user); $this->pass = base64_encode($pass); $this->debug = $debug; $this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if ($this->socket) { $this->result_str = "Create socket:" . socket_strerror(socket_last_error()); $this->debug_show($this->result_str); } else { exit("Initialize Faild,Check your internet seting,please"); } $this->conn = socket_connect($this->socket, $this->host, $this->port); if ($this->conn) { $this->result_str = "Create SOCKET Connect:" . socket_strerror(socket_last_error()); $this->debug_show($this->result_str); } else { exit("Initialize Faild,Check your internet seting,please"); } $this->result_str = "Server answer:<font color=#cc0000>" . socket_read($this->socket, 1024) . "</font>"; $this->debug_show($this->result_str); } function debug_show($str) { if ($this->debug) { echo $str . "<p>\r\n"; } } function send($from, $to, $subject, $body) { if ($from == "" || $to == "") { exit("type mail address please"); } if ($subject == "") $sebject = "none title"; if ($body == "") $body = "none content"; $All = "From:$from;\r\n"; $All .= "To:$to;\r\n"; $All .= "Subject:$subject;\r\n"; if ($this->mailformat == 1) { $All .= "Content-Type:text/html;\r\n"; } else { $All .= "Content-Type:text/plain;\r\n"; } $All .= "Charset:" . $this->charset . ";\r\n\r\n"; $All .= " " . $body; $this->in = "EHLO HELO\r\n"; $this->docommand(); $this->in = "AUTH LOGIN\r\n"; $this->docommand(); $this->in = $this->user . "\r\n"; $this->docommand(); $this->in = $this->pass . "\r\n"; $this->docommand(); if (!eregi("235", $this->result_str)) { $this->result_str = "smtp auth faild"; $this->debug_show($this->result_str); return 0; } $this->in = "MAIL FROM: $from\r\n"; $this->docommand(); $this->in = "RCPT TO: $to\r\n"; $this->docommand(); $this->in = "DATA\r\n"; $this->docommand(); $this->in = $All . "\r\n.\r\n"; $this->docommand(); if (!eregi("250", $this->result_str)) { $this->result_str = "Send mail faild!"; $this->debug_show($this->result_str); return 0; } $this->in = "QUIT\r\n"; $this->docommand(); socket_close($this->socket); return 1; } function docommand() { socket_write($this->socket, $this->in, strlen($this->in)); $this->debug_show("Client command:" . $this->in); $this->result_str = "server answer:<font color=#cc0000>" . socket_read($this->socket, 1024) . "</font>"; $this->debug_show($this->result_str); } } ?> Hi the user fill details and then the email his sent to me the only problem is that the emails keeps going to my spam, can someone help me out please I looked already php website and email format looks the same. This is the link to my form. http://www.people.eurico.co.uk/ here my form script Code: [Select] <?php // Set email variables $email_to = 'xxxxx@xxxxxxx.co.uk'; $email_subject = 'Call back form'; // Set required fields $required_fields = array('fullname','email','telephone','comment'); // set error messages $error_messages = array( 'fullname' => 'Please enter a Name to proceed.', 'email' => 'Please enter a valid Email.', 'telephone' => 'Please telephone.', 'comment' => 'Please enter your Message to continue.' ); // Set form status $form_complete = FALSE; // configure validation array $validation = array(); // check form submittal if(!empty($_POST)) { // Sanitise POST array foreach($_POST as $key => $value) $_POST[$key] = remove_email_injection(trim($value)); // Loop into required fields and make sure they match our needs foreach($required_fields as $field) { // the field has been submitted? if(!array_key_exists($field, $_POST)) array_push($validation, $field); // check there is information in the field? if($_POST[$field] == '') array_push($validation, $field); // validate the email address supplied if($field == 'email') if(!validate_email_address($_POST[$field])) array_push($validation, $field); } // basic validation result if(count($validation) == 0) { // Prepare our content string $email_content = 'peoplesmartlearning.co.uk: ' . "\n\n"; // simple email content foreach($_POST as $key => $value) { if($key != 'submit') $email_content .= $key . ': ' . $value . "\n"; } // if validation passed ok then send the email mail($email_to, $email_subject, $email_content); // Update form switch $form_complete = TRUE; } } function validate_email_address($email = FALSE) { return (preg_match('/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i', $email))? TRUE : FALSE; } function remove_email_injection($field = FALSE) { return (str_ireplace(array("\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:","to:","cc:"), '', $field)); } ?> The HTML Code: [Select] <div class="call_us_form"> <p class="title">WE'LL CALL YOU BACK</p> <?php if($form_complete === FALSE): ?> <form class="contact_form" id="fm-form" method="post" action="index.php" > <fieldset> <div class="fm-req"> <label for="fm-firstname">Name</label> <input type="text" id="fullname" class="detail" name="fullname" value="<?php echo isset($_POST['fullname'])? $_POST['fullname'] : ''; ?>" /> <?php if(in_array('fullname', $validation)): ?><script type="text/javascript">alert("Please enter a Name"); history.back();</script><?php endif; ?> </div> <div class="fm-req"> <label for="fm-firstname">Email</label> <input type="text" id="email" class="detail" name="email" value=" <?php echo isset($_POST['email'])? $_POST['email'] : ''; ?>" /> <?php if(in_array('email', $validation)): ?><script type="text/javascript">alert("Please enter a valid Email Address"); history.back();</script><?php endif; ?> </div> <div class="fm-req"> <label for="fm-firstname">Number</label> <input type="text" id="telephone" class="detail" name="telephone" value="<?php echo isset($_POST['telephone'])? $_POST['telephone'] : ''; ?>" /> <?php if(in_array('telephone', $validation)): ?><script type="text/javascript">alert("Please enter telephone number"); history.back();</script><?php endif; ?> </div> <div class="fm-req"> <label for="fm-lastname">Message</label> <textarea cols="40" rows="5" id="comment" name="comment" class="mess"><?php echo isset($_POST['comment'])? $_POST['comment'] : ''; ?></textarea> <?php if(in_array('comment', $validation)): ?><script type="text/javascript">alert("Please enter your message"); history.back();</script><?php endif; ?> </div> <input class="submit_button" type="submit" value="Call us" /> </fieldset> </form> <?php else: ?> <p>Thank you for your Message!</p> <p>We will get back to you as soon as we can</p> <script type="text/javascript"> setTimeout ('ourRedirect()', 5000) function ourRedirect () { location.href='index.php' } </script> <?php endif; ?> Hei, please can anyone help me? I guess it's done with if function - i can be wrong too. :/ I want to get about the same "step by step" stuff.. Look example: http://p6lva.eu/site/realinfo.php I tried by my own, but I failed too much : <?php $nick = $_GET['nick']; $server = $_GET['server']; $teenus = $_GET['teenus']; if (!empty($nick) && $server === null) { echo "<center>Choose server:<br><br>\n <a href='realinfo.php?server=1&nick=$nick' style='text-decoration: none;'><button style='width: 250px; text-align: left;'><center>\n Server 1</center></button></a> </center>"; } else { echo ""; } if (!empty($server) && $teenus === null) { include "service1.php"; } else { echo "show frontpage"; } if (!empty($teenus)) { if ($teenus === vip && $server === 1) { include "vip.php"; } if ($teenus === admin && $server === 1) { include "admin.php"; } } else { echo "You must choose service!!! Or this service doesnt in our database!!!"; } if (isset($nick) || isset($server) || isset($teenus)) { // if not added one of the values - like $server, $nick or $teenus then show frontpage echo ""; } else { include 'frontpage.php'; } ?> HELP Ok so this is what I am looking for and I cannot seem to find any documentation on it! I have some html files which I want to call up by using the following: engine.php?id=? with the questionmark being 1,2,3,4,5,6, etc... where each number is a different HTML page, I just want it to look a little cleaner then if I just have it redirect to each page itself I mean come on what looks better: http://localhost/engine.php?id=1 <------ http://localhost/home.html Any guidance is welcome. Thanks, Drew I recently tried to start using drupal as a CMS for my site but their handbook is almost useless since I'm pretty much learning this stuff new. Can I use HTML or do I have to use PHP? Does anyone have any other useful guides they could show me?
Hello. Assuming that I have two variables: $exURL=@$HTTP_REFERER; $goodURL = 'http://www.SomeSite/login/'; How can I check if the two URLs match each other? Regards This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=311125.0 Newbie question, sorry. I have a Drupal custom content type - "EXIF Image" that is posting metadata. It works, but I'd like to speed up the posting process by autopopulating the node title with metadata as well. I've enabled auto_nodetitle, but I'm stuck on the correct syntax for the PHP. I'm not a PHP progrmmer, and I don't even play one on TV. Could someone direct me to the correct syntax? I have a field__iptc_headline that I'm trying to reference. Not sure where the extra underscore came from, but it's working with EXIF module.
<?php print render($content['field__iptc_headline']); ?> Hi, I've inherited a website with a problem! Basically the site runs pommo mailing list, which has worked fine for years. Recently though the website domain name changed. Since then - or at least at a similar time - pommo has just stopped working completely. It does nothing but outputs blank pages. I've never done any php development so I've no idea where to start in terms of debugging this. I've checked that the files etc all exist on the server: they do. I've uploaded a test html page which works. I've uploaded a test php page containing: <?php phpinfo( ); ?> and it works. But when I visit any page in the pommo application, the browser just renders a totally empty white page - no source HTML at all, just nothing! Can anyone suggest how to debug this? Even an error message would be somewhere to start. Thanks all! This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=348274.0 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 ?> i wanting users to be able to update there email address and check to see if the new email already exists. if the email is the same as current email ignore the check. i have no errors showing up but if I enter a email already in the db it still accepts the new email instead of bringing the back the error message. Code: [Select] // email enterd from form // $email=$_POST['email']; $queryuser=mysql_query("SELECT * FROM members WHERE inv='$ivn' ") or die (mysql_error()); while($info = mysql_fetch_array( $queryuser )) { $check=$info['email']; // gets current email // } if($check!=$email){ // if check not equal to $email check the new email address already exists// $queryuser=mysql_query("SELECT * FROM members WHERE email='$email' "); //$result=mysql_query($sql); $checkuser=mysql_num_rows($queryuser); if($checkuser != 0) { $error= "0"; header('LOCATION:../pages/myprofile.php?id='.$error.''); } } cheers As the topis says, I need help with an email form. You must have valid email address to go further, so lets say you write asdada as email, you won't be able to register the account, you must have asdada@hotmai.com or something like that. If anyone knows it would be awesome! Im having trouble getting this form to work on my website. It all seems to work ok, however when i test it, i dont recieve any emails to my inbox. Godaddy seems to think that I am connecting to their server in the correct manner, but say that they cannot advise on customers codeing issues. I thought that somebody in this forum maybe able to give me some pointers? [<?php ini_set('sendmail_from', 'user@domain.tld'); ini_set('SMTP', 'relay-hosting.secureserver.net'); $subject = $_POST["subject"]; $message = $_POST["message"]; $from = $_POST["from"]; $name = $_POST["name"]; $phone = $_POST["phone"]; $verif_box = $_POST["verif_box"]; $subject = stripslashes($subject); $message = stripslashes($message); $from = stripslashes($from); $name = stripslashes($name); $phone = stripslashes($phone); $embody = "$name $phone $message"; if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){ mail("ed@treework.net", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR'].$embody, "From: $from"); setcookie('tntcon',''); } else if(isset($message) and $message!=""){ header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true"); exit; } else { echo "no variables received, this page cannot be accessed directly"; exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>E-Mail Sent</title> <style type="text/css"> <!-- body,td,th { font-family: Arial, Helvetica, sans-serif; font-size: 12px; } --> </style></head> <body> Email sent. Thank you.<br /> <br /> Return to <a href="/">home page</a> ? </body> </html>] To PHPBuilder Forumgoers, My PHP email form is not sending to the address I specified, and I think it's because I added in an if-else statement to check for input of a valid email address. I've put the HTML and PHP scripts online and filled the live form out with several valid email addresses, with no success. I tried changing the recipient's email, too, with no success. Am I missing a glaring error in my code, or maybe things are just not in the right order? Any help would be SUPER appreciated. Thank you so much. The code (in external PHP file "order.php") : <?php $to = "myemailwashere@website.com"; $subject = "Custom Order Message"; $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; $from = $_REQUEST['name']; $budget = $_REQUEST['budget']; $colors[] = $_REQUEST['colors[]']; $headers = "From: $email"; $sent = mail($to, $from, $subject, $message, $budget, $headers) ; if( !eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*". "@([a-z0-9]+([\.-][a-z0-9]+))*$",$email)) { header( 'Location: order/invalidemail.html' ) ; }else{ header( 'Location: order/messagesent.html' ) ; } if($sent) {print "Your custom order query was sent successfully."; } else {print "An error occured while sending your custom order query. Please try again."; } ?> dear friends , i have this html page "</head> <body> <table width="93%" border="0" align="center" cellpadding="2" cellspacing="4"> <tr> <td height="35" colspan="3" valign="top" class="heading" style="padding-top:8px; color:#448B9A; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold;"><strong>Contact Us :</strong></td> </tr> <tr> <td width="36%" class="body">Your Name:</td> <td width="64%" colspan="2"> <input type="text" name="textfield3" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">Address:</td> <td colspan="2"> <input type="text" name="textfield32" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">City:</td> <td colspan="2"> <input type="text" name="textfield33" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body"> Country:</td> <td colspan="2"> <input type="text" name="textfield34" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">Phone no:</td> <td colspan="2"> <input type="text" name="textfield35" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">email Address:</td> <td colspan="2"> <input type="text" name="textfield36" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">Comments:</td> <td colspan="2"><textarea name="textarea" rows="5" cols="" style="width:250px;"></textarea></td> </tr> <tr> <td> </td> <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="28%"> <input type="image" name="imageField2" src="/images/submit.gif" width="62" height="22" /></td> <td width="72%"> <input type="image" name="imageField3" src="/images/reset.gif" width="62" height="22" /></td> </tr> </table></td> </tr> </table> </body> </html> " how i can use this to send email to my email address John@gmail.com thru site when someone submit the form [attachment deleted by admin] Hello my great PHP gurus, I have a question that might be simple for some of you geniuses. I have simple HTML email form getting sent by a PHP script and I cant get it to work right. All I want is the get the email, name, subject and in the body I need to have 3 variables ( name (again) Telephone and details. This is the code I have so far: HTML Form (relevant details only): <input type="text" name="name" id="name" class="input" /> <input type="text" name="subject" id="subject" class="input" /> <input type="text" name="email" id="customer_mail" class="input" /> <input type="text" name="telephone" id="telephone" class="input" /> <textarea name="detail" cols="10" rows="10" id="detail"></textarea> The PHP script is: <?php // Contact subject $subject ="$subject"; // Details $message="$detail"; // Name $name="$name"; // Mail of sender $mail_from="$customer_mail"; // From $header="from: $name <$mail_from>"; // Enter your email address $to ='onzeon@me.com'; $send_contact=mail($to,$subject,$message,$header); // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ echo "We received you message, thank you"; } else { echo "ERRO"; } ?> I also tried this (with no success): <?php // Contact subject $subject ="$assunto"; // Details $body = $name; $body .= "/n"; $body .= "Telephone : ".$telephone."/n"; $body .= "Subject : ".$subject."/n"; $body .= "Details : ".$details; // Name $name="$name"; // Mail of sender $mail_from="$customer_mail"; // From $header="from: $name <$mail_from>"; // Enter your email address $to ='onzeon@me.com'; $send_contact=mail($to,$subject,$header,$body); // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ echo "We received you message, thank you"; } else { echo "ERRO"; } ?> CAN ANYONE HELP, PLEASE.. Thank you very much. Cleve. Ok I have two separate issues. The first is that I want to format the email so that the titles of the form areas are bolded (i.e., Name: Title:, etc...) the second issue is that I don't want the email to contain the blank fields (I.e. witness 2 etc.. if left empty) any help is appreciated here is my code Code: [Select] <p class="style2"><span class="style5"><strong>Incident / Unusual Occurrence Report</strong></span><br> Danville Area Community College<br><br> REPORT FORM</p> <table width="481" height="657" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td rowspan="2" valign="top" bgcolor="#FFFFFF" style="width: 481px"> <p align="center"class="style3"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <?php $problems = array(); $showform = 0; $errorMessage = ""; function validate($field, $value) { // || $field == "id" || $field == "phone" || $field == "course" || $field == "instructor" /*if ($field == "name" || $field == "email" || $field == "computers" || $field == "info") {*/ if ($value == "") { return 0; } else { return 1; } /*}*/ /*if ($field == "system" || $field == "browser" || $field == "issue" || $field == "multiple") { if ($value == "----" || $value == "") { return 0; } else { return 1; } }*/ } if($_POST) { //'id','phone','course','instructor', $fields = array('name','title', 'date', 'time', 'building', 'room', 'location', 'person', 'title1', 'phone1', 'explanation', 'security', 'police', 'witness', 'acttaken', 'followact'); $x = 0 - 1; foreach($fields as $field) { if(isset($_POST[$field])) { $validation = validate($field, $_POST[$field]); if ($validation == 1) { $x++; $info[$x] = $_POST[$field]; } else { $problems[$field] = 1; $showform = 1; } } else { $problems[$field] = 1; $showform = 1; } } } else { $showform = 1; } if(count($problems) < 1 && $_POST) { // DO THE MAILING HERE $fields = array('title', 'name','date', 'time', 'building', 'room', 'location', 'title1','person', 'phone1', 'title2', 'person2', 'phone2','title3','person3', 'phone3','title4','person4', 'phone4', 'type1', 'type2', 'type3', 'type4', 'type5', 'type6', 'type7', 'type8', 'type9', 'explanation', 'security', 'police', 'witness','wtitle1', 'wperson', 'wphone1', 'wtitle2', 'wperson2', 'wphone2','wtitle3','wperson3', 'wphone3', 'acttaken', 'followact'); $to = "ampeck@earthlink.net"; $to2 = "aabdelzaher@dacc.edu"; $subject = "Incident / Unusual Occurrence Report"; $headers = "From: noreply@dacc.edu\r\n" . "X-Mailer: php"; $greet = "The following was submitted on " . date("F j, Y, g:i a") . "\n\n"; $body = $greet ; $cn = 1; foreach($fields as $efield) { if(isset($_POST[$efield])) { if($efield == "type1" || $efield == "type2" || $efield == "type3" || $efield == "type4" || $efield == "type5" || $efield == "type6" || $efield == "type7" || $efield == "type8" || $efield == "type9" ) { $body.= "Type of Occurrence:" . $_POST[$efield] . "\n\n"; $cn++; } elseif($efield == "title") { $body.= "Name of Person Filing Report: " . $_POST[$efield] . " "; } elseif($efield == "name") { $body.= " " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif($efield == "date") { $body.= "Date of Occurrence: " . $_POST[$efield] . " \t "; } elseif ($efield == "time") { $body.= "Time: " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif ($efield == "building") { $body.= "Building: " . $_POST[$efield] . " \t\t "; } elseif ($efield == "room") { $body.= "Room: " . $_POST[$efield] . "\n\n"; } elseif ($efield == "location") { $body.= "Description of Location: " . $_POST[$efield] . "\t\r\n________________________________________\n\n"; } elseif ($efield == "title1") { $body.= "First Person involved: " . $_POST[$efield] . " "; } elseif ($efield == "person") { $body.= " \t" . $_POST[$efield] . "\n"; } elseif ($efield == "phone1") { $body.= "Phone : " . $_POST[$efield] . "\n________________________________________\n\n"; }elseif ($efield == "title2") { $body.= "Second Person involved: " . $_POST[$efield] . " "; } elseif ($efield == "person2") { $body.= " " . $_POST[$efield] . "\n"; } elseif ($efield == "phone2") { $body.= "Phone : " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif ($efield == "title3") { $body.= "Third Person involved: " . $_POST[$efield] . " "; } elseif ($efield == "person3") { $body.= " " . $_POST[$efield] . "\n"; } elseif ($efield == "phone3") { $body.= "Phone: " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif ($efield == "title4") { $body.= "Fourth Person Involved: " . $_POST[$efield] . " "; } elseif ($efield == "person4") { $body.= " " . $_POST[$efield] . " \n"; } elseif ($efield == "phone4") { $body.= "Phone: " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif ($efield == "explanation") { $body.= "Detailed Explanation: " . $_POST[$efield] . "\t\r\n________________________________________\n\n"; } elseif ($efield == "security") { $body.= "Security called: " . $_POST[$efield] . "\n\n"; } elseif ($efield == "police") { $body.= "Police called: " . $_POST[$efield] . "\n\n"; } elseif ($efield == "witness") { $body.= "Were there witnesses: " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif($efield == "wtitle1") { $body.= "Witness: " . $_POST[$efield] . " "; } elseif ($efield == "wperson") { $body.= " \t" . $_POST[$efield] . "\n"; } elseif ($efield == "wphone1") { $body.= "Phone : " . $_POST[$efield] . "\n________________________________________\n\n"; }elseif ($efield == "wtitle2") { $body.= "Second witness: " . $_POST[$efield] . " "; } elseif ($efield == "wperson2") { $body.= " " . $_POST[$efield] . "\n"; } elseif ($efield == "wphone2") { $body.= "Phone : " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif ($efield == "wtitle3") { $body.= "Third witness: " . $_POST[$efield] . " "; } elseif ($efield == "wperson3") { $body.= " " . $_POST[$efield] . "\n"; } elseif ($efield == "wphone3") { $body.= "Phone: " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif ($efield == "acttaken") { $body.= "Immediate Action Taken: " . $_POST[$efield] . "\t\r\n________________________________________\n\n"; } elseif ($efield == "followact") { $body.= "What Follow-up Action will be taken: " . $_POST[$efield] . "\t\r\n________________________________________\n\n"; } } } mail($to, $subject, $body, $headers); mail($to2, $subject, $body, $headers); ?> <p class="style1">Your report has been submitted.<br><br></p> <?php } if($showform == 1) { ?> <?php if(count($problems) > 0) { ?> <p><strong><font color="red">PLEASE CORRECT ANY FIELDS WITH A RED * BY THEM</font></strong></p> <?php } ?> <form action="" method="post"> <fieldset> <legend> <span lang="en-us">Incident Report</span> </legend> <div class="style6"> <div class="style7"> <br> <table style="width: 100%"> <tr> <td style="width: 248px" class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="name">Name(s): <?php if(isset($problems['name'])) {?><font color="red">*</font><?php } ?></label><br> <input class="inputstyle" type="text" name="name" value="<?php if(isset($_POST['name'])){ print($_POST['name']); }?>" style=" width: 288px"></font></td> <td style="width: 148px" class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="title">Title: <?php if(isset($problems['title'])) {?><font color="red">*</font><?php } ?></label><br> <input class="style6" type="text" name="title" value="<?php if(isset($_POST['title'])){ print($_POST['title']); }?>" style=" width: 132px"></font></td> </tr> </table><p></p> <table > <tr> <td style="width: 132px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="date">Date of Occurrence: <?php if(isset($problems['date'])) {?><font color="red">*</font><?php } ?></label><br> <input class="inputstyle" type="text" name="date" value="<?php if(isset($_POST['date'])){ print($_POST['date']); }?>" style=" width: 118px"></font></td> <td style="width: 170px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="time">Time of Occurrence: <?php if(isset($problems['time'])) {?><font color="red">*</font><?php } ?></label><br> <input class="inputstyle" type="text" name="time" value="<?php if(isset($_POST['time'])){ print($_POST['time']); }?>" style=" width: 88px"></font></td> <td style="width: 111px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="building">Building: <?php if(isset($problems['building'])) {?><font color="red">*</font><?php } ?></label><br> <input class="inputstyle" type="text" name="building" value="<?php if(isset($_POST['building'])){ print($_POST['building']); }?>" style=" width: 110px"></font></td> <td style="width:100px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="room">Room: <?php if(isset($problems['room'])) {?><font color="red">*</font><?php } ?></label><br> <input class="inputstyle" type="text" name="room" value="<?php if(isset($_POST['room'])){ print($_POST['room']); }?>" style=" width: 60px"></font></td> </tr> </table> <table style="width: 100%; height: 72px;"> <tr> <td class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="location">Location Description: <?php if(isset($problems['location'])) {?><font color="red">*</font><?php } ?></label><br> <textarea name="location" style=" width: 383px; height: 115px;" ></textarea></font><br></td> </tr> </table> <br> <p class="style5">Person (s) involved in incident</p> <table > <tr> <td style="width: 200px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <span lang="en-us"> <label class="formtext" for="person">Name:<?php if(isset($problems['person'])) {?><font color="red">*</font><?php } ?></label></span><br> <input class="inputstyle" type="text" name="person" value="<?php if(isset($_POST['person'])){ print($_POST['person']); }?>" style="width: 249px"></font></td> <td style="width: 114px"><label class="formtext" for="title1"> <span lang="en-us">Title</span>:</label><br> <font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <input class="inputstyle" type="text" name="title1" value="<?php if(isset($_POST['title1'])){ print($_POST['title1']); }?>" style=" width: 100px"></font></td> <td style="width: 104px"><label class="formtext" for="phone1"> <span lang="en-us">Phone</span>:</label><br> <input class="inputstyle" type="text" name="phone1" value="<?php if(isset($_POST['phone1'])){ print($_POST['phone1']); }?>" style="width: 75px"></td> </tr> <tr> <td style="width: 224px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <input type="text" name="person2" value="<?php if(isset($_POST['person2'])){ print($_POST['person2']); }?>" style="width: 249px" style="width: 249px"></font></td> <td style="width: 114px"> <input class="inputstyle" type="text" name="title2" value="<?php if(isset($_POST['title2'])){ print($_POST['title2']); }?>" style="width: 100px"></td> <td style="width: 104px"> <input class="inputstyle" type="text" name="phone2" value="<?php if(isset($_POST['phone3'])){ print($_POST['phone3']); }?>" style="width: 75px"></td></tr> <tr> <td style="width: 224px; height: 26px;"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <input class="inputstyle" type="text" name="person3" value="<?php if(isset($_POST['person3'])){ print($_POST['person3']); }?>" style="width: 252px"></font></td> <td style="width: 114px; height: 26px;"> <input class="inputstyle" type="text" name="title3" value="<?php if(isset($_POST['title3'])){ print($_POST['title3']); }?>" style=" width: 100px"></td> <td style="width: 104px"> <input class="inputstyle" type="text" name="phone3" value="<?php if(isset($_POST['phone3'])){ print($_POST['phone3']); }?>" style=" width: 75px"></td></tr> <tr> <td style="width: 224px"> <input class="inputstyle" type="text" name="person4" value="<?php if(isset($_POST['person4'])){ print($_POST['person4']); }?>" style=" width: 252px"></td> <td style="width: 114px; height: 26px;"> <input class="inputstyle" type="text" name="title4" value="<?php if(isset($_POST['title4'])){ print($_POST['title4']); }?>" style=" width: 100px"></td> <td style="width: 104px"> <input class="inputstyle" type="text" name="phone4" value="<?php if(isset($_POST['phone4'])){ print($_POST['phone4']); }?>" style=" width: 75px"></td></tr> </table><fieldset> <legend> Please Select at least one: </legend> <p class="style5">Type of Alleged Occurrence:</p> <font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <table style="width: 100%"> <tr> <td style="width: 33%; height: 57px;"><input class="inputstyle" type="checkbox" name="type1" value="Disgruntled Action"><label class="formtext" for="type1">Disgruntled Action</label><br></td> <td style="width: 33%; height: 57px;"> <input class="inputstyle" type="checkbox" name="type2" value="Obscene Language"><label class="formtext" for="type2">Obscene Language</label><br></td> <td style="width: 33%; height: 57px;"><input class="inputstyle" type="checkbox" name="type3" value="Verbal Threats"><label class="formtext" for="type3">Verbal Threats</label><br></td> </tr> <tr> <td style="width: 33%; height: 57px;"><input class="inputstyle" type="checkbox" name="type4" value="Physical Threats"><label class="formtext" for="type4">Physical Threats<br></label><br></td> <td style="width: 33%; height: 57px;"><input class="inputstyle" type="checkbox" name="type5" value="Inappropriate Physical Behavior"><label class="formtext" for="type5">Inappropriate Physical <span lang="en-us"> </span>Behavior</label><br></td> <td style="width: 33%; height: 57px;"><input class="inputstyle" type="checkbox" name="type6" value="Written Threat"><label class="formtext" for="type6">Written Threat<br></label></td> </tr> <tr> <td style="width: 33%; height: 57px;"><input class="inputstyle" type="checkbox" name="type7" value="Sexual Offense"><label class="formtext" for="type7">Sexual Offense<br></label></td> <td style="width: 33%; height: 57px;"><input class="inputstyle" type="checkbox" name="type8" value="Robbery or Other Crime"><label class="formtext" for="type8">Robbery or Other <span lang="en-us"> <br> </span>Crimes</label><br></td> <td style="width: 33%; height: 57px;" class="style6"><input class="inputstyle" type="checkbox" name="type9" value="Other"><label class="formtext" for="type9">Other</label><br> <br> </td></div> </tr> </table><p></p> </font><table style="width: 100%; height: 72px;"> <tr> <td class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="explanation">Detailed Explanation: <?php if(isset($problems['explanation'])) {?><font color="red">*</font><?php } ?></label><br> <textarea name="explanation" style=" width: 450px; height: 220px;" ></textarea></font><br></td> </tr> </table> </fieldset><br><br> <br> <fieldset> <legend> Actions Taken: </legend> <div class="style7"> <br> <label class="formtext" for="security"><?php if(isset($problems['security'])) {?><font color="red">*</font><?php } ?>Was Security Notified:</label> <select name="security" class="dropdownstyle"> <option value="">--Choose one--</option> <option value="Yes">Yes</option> <option value="No">No</option></select><br><br> <label class="formtext" for="police"><?php if(isset($problems['police'])) {?><font color="red">*</font><?php } ?>Were Police Notified:</label> <select name="police" class="dropdownstyle"> <option value="">--Choose one--</option> <option value="Yes">Yes</option> <option value="No">No</option></select><br><br> <label class="formtext" for="witness"><?php if(isset($problems['witness'])) {?><font color="red">*</font><?php } ?>Were there Witnesses?<br> (if yes, list names of witnesses):<span lang="en-us"> </span></label> <select name="witness" class="dropdownstyle"> <option value="">--Choose one--</option> <option value="Yes">Yes</option> <option value="No">No</option></select><br> <p class="style5">Witnesses to the Incident:</p> <table > <tr> <td style="width: 200px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <span lang="en-us"> <label class="formtext" for="wperson">Name:</label></span><br> <input class="inputstyle" type="text" name="wperson" value="<?php if(isset($_POST['wperson'])){ print($_POST['wperson']); }?>" style="width: 249px"></font></td> <td style="width: 114px"><label class="formtext" for="wtitle1"> <span lang="en-us">Title</span>:</label><br> <font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <input class="inputstyle" type="text" name="wtitle1" value="<?php if(isset($_POST['wtitle1'])){ print($_POST['wtitle1']); }?>" style=" width: 100px"></font></td> <td style="width: 104px"><label class="formtext" for="wphone1"> <span lang="en-us">Phone</span>:</label><br> <input class="inputstyle" type="text" name="wphone1" value="<?php if(isset($_POST['wphone1'])){ print($_POST['wphone1']); }?>" style="width: 75px"></td> </tr> <tr> <td style="width: 224px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <input type="text" name="wperson2" value="<?php if(isset($_POST['wperson2'])){ print($_POST['wperson2']); }?>" style="width: 249px; width : 249px"></font></td> <td style="width: 114px"> <input class="inputstyle" type="text" name="wtitle2" value="<?php if(isset($_POST['wtitle2'])){ print($_POST['wtitle2']); }?>" style="width: 100px"></td> <td style="width: 104px"> <input class="inputstyle" type="text" name="wphone2" value="<?php if(isset($_POST['wphone3'])){ print($_POST['wphone3']); }?>" style="width: 75px"></td></tr> <tr> <td style="width: 224px; height: 26px;"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <input class="inputstyle" type="text" name="wperson3" value="<?php if(isset($_POST['wperson3'])){ print($_POST['wperson3']); }?>" style="width: 252px"></font></td> <td style="width: 114px; height: 26px;"> <input class="inputstyle" type="text" name="wtitle3" value="<?php if(isset($_POST['wtitle3'])){ print($_POST['wtitle3']); }?>" style=" width: 100px"></td> <td style="width: 104px"> <input class="inputstyle" type="text" name="wphone3" value="<?php if(isset($_POST['wphone3'])){ print($_POST['wphone3']); }?>" style=" width: 75px"></td></tr> </table></div></fieldset> <br><br><table style="width: 100%; height: 72px;"> <tr> <td class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="acttaken">Immediate Action Taken: <?php if(isset($problems['acttaken'])) {?><font color="red">*</font><?php } ?></label><br> <textarea name="acttaken" style=" width: 450px; height: 220px;" ></textarea></font><br></td> </tr> </table> <br><br> <table style="width: 100%; height: 72px;"> <tr> <td class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="followact">Follow-up Action Taken: <?php if(isset($problems['followact'])) {?><font color="red">*</font><?php } ?></label><br> <textarea name="followact" style=" width: 450px; height: 220px;" ></textarea></font><br></td> </tr> </table> Please help me with this. I'm using this little PHP program to collect some information and get them emailed to me...everything is working but no messages in the body. The email comes to me but nothing in the body. I'm supposed to get the name, email, phone # and how soon but I receive a blank email. I have the script posted on celebritynosejobs.net if you would like to see it! |