PHP - Email Form Problems.
So, I'm working on this contact form for a project. I found a tutorial on building such a form which turned out to be simple enough. It seems to work as far as when I submit, the echo response shows up in the browser window..however, there's no actual email that shows up in my mailbox.
Here's the code for the form: Code: [Select] <form name="contact" id="contact" method="post" action="mailer.php"> <p> <label for="fullname">Name:</label> <input type="text" name="name" class="txt"> </p> <p> <label for="address"> Property Street Address:</label> <input type="text" name="address" class="txt"> </p> <p> <label for="city">City:</label> <input type="text" name="city" class="txt"> </p> <p> <label for="state">State:</label> <input type="text" name="state" class="txt"> </p> <p> <label for="zip">Zip:</label> <input type="text" name="zip" class="txt"> </p> <p> <label for="owners">Owner(s) of Record:</label> <input type="text" name="owner" class="txt"> </p> <p> <label for="parcel">Parcel ID# (Leave Blank if Unknown):</label> <input type="text" name="parcel" class="txt"> </p> <p> <label for="phone">Phone:</label> <input type="text" name="phone" class="txt"> </p> <p> <label for="email">Email:</label> <input type="text" name="email" class="txt"> </p> <p> <label for="thanking">Who do we thank for referring you?</label> <input type="text" name="thanking" class="txt"> </p> <p><strong>Ready to reduce your soaring property taxes? Then check off level of assistance.</strong></p> <p> <input type="radio" value="yes" name="option"> Tool Box <input type="radio" value="no" name="option"> Self Starter Kits <input type="radio" value="no" name="option"> Predetermination Analysis <input type="radio" value="no" name="option"> Consultation <input type="radio" value="no" name="option"> Other </p> <p> Message: <textarea rows="9" name="comment" cols="30"></textarea> </p> <div id="subButton"> <input class="buttons" type="image" src="images/formSubmit.gif" tabindex="3" name="submit" value="submit" /> </div> </form> Here's the code for the script: Code: [Select] <?php if(isset($_POST['submit'])) { $to = "xxxxxxx@goofyEmail.com"; $subject = "Service inquiry"; $name = $_POST['name']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $owner = $_POST['owner']; $parcel = $_POST['parcel']; $phone = $_POST['phone']; $email = $_POST['email']; $thanking = $_POST['thanking']; $comment = $_POST['comment']; $option = $_POST['radio']; $body = "From: $name\n Address: $address\n City: $city\n State: $state\n Zip: $zip\n Owner: $owner\n Parcel Number: $parcel\n Phone Number: $phone\n Referral Name: $thanking\n E-Mail: $email\n Option: $option\n Message: $comment\n "; echo "Thank you! Your Wicked Awesome Service Inquiry has been submitted to $to!"; mail($to, $subject, $body, "From: $from"); } else { echo "Oops. You have reached this page in error."; } ?> I also sent this to a friend for him to test on his server. Same results..form works but no email arrives. now, someone gave me this code to try out in order to make sure it's not my server and is in fact my code: Code: [Select] <?php $mail_test = mail("youremail@yourdomain.com", "Test Email", "This is a test message..."); if( $mail_test === true ) { echo "Sent email"; } else { echo "Mail failed!"; } ?> tried the page...loaded it in my browser and it worked fine...but no email hit my inbox. So, I'm not sure if it's my code or my hosting. I have a flash - to - php form for my personal site that works fine so that would have me thinking it might be my hosting. I tried moving this form and the script to a different location on the server thinking that might make a difference but it didn't. Also, again, I had a friend load it on their server as well...thinking it might be my server but the result is the same. So, I'm quite sure it's my code...but I'm just not sure where the issue is. One other thing, I looked at another tutorial with the most basic form I could find...email address and message input, button...nothing more. Same result. Not sure where to go from here. Any help or input is appreciated. Similar TutorialsI have a form on a page which is accessed when a user logs into their account. The form dynamically pulls bits of the users info from 2 tables in a mysql database, Tables (ITEMS) and Table (USERS). Table (USERS) holds the users info (NAME, EMAIL ETC) while Table (ITEMS) hold information about the users items for which they may have several of. When the form page is accessed all the users items from Table (ITEMS) are dynamically shown on the form with several radio buttons at the side of each item. The user can tick certain radio buttonss at the side of each item and click the send button. TRYING TO ACHIEVE... After the form is sent a thank you message is returned on the same page with details of the items and what radios were ticked. An Email of the same is sent to user with info of the items and what radios were ticked. An Email is also sent to me with same info of the items and what radios were ticked. WHAT I AM ACHIEVING SO FAR WITH CODE BELOW: The form page is ok showing all users items, radios, send button etc. The returned thank you page is fine showing items, what radios were checked etc. Even the email part is working sending an email to the user and myself. THE PROBLEM IS THAT A SEPERATE EMAIL IS SENT TO BOTH OF US FOR EACH ITEM THE USER HAS IN THE DATABASE. I JUST WANT ONE EMAIL SENDING TO BOTH OF US DETAILING ALL ITEMS. I realise this is because of the while statement in the call to the database which is looping the below code for each item thus sending an email for each item. What I can not suss out is how to send just the one email with all items on. Tried moving the closing loop bracket all over the place and parts of the code but to not avail. THE CODE: (some unecessary code removed from echo/thank you to simplify) <table width="100%"> <tr> <td class="bodytext"><strong>Name</strong></td> <td class="bodytext"><strong>Ref</strong></td> <td><strong>Status</strong></td> <td><strong>Type</strong></td> <td><strong>Date</strong></td> <td><strong>Extend</strong></td> <td><strong>Feature</strong></td> <td><strong>Offer</strong></td> </tr> <form action="example-this-page" method="post"> <input type="hidden" name="action" value="0"> <input type="hidden" name="id" value="<?php echo $_REQUEST["id"]; ?>"> <?php $sql = "SELECT * FROM ".$TABLES["items"]." WHERE user_id='".$_SESSION["UserAccount"]."'"; $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql); while ($ITEMS = mysql_fetch_assoc($sql_result)) { $sql = "SELECT * FROM ".$TABLES["users"]." WHERE id='".$ITEMS["user_id"]."'"; $sql_resultT = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql); $USER=mysql_fetch_assoc($sql_resultT); ?> <? if (isset($action)) { $to = $USER["email"]; $mailheader = "From: $email\r\n"; $mailheader .= "Reply-To: $email\r\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $msg = "Dear ".stripslashes($USER["name"])."<br><br> <table><tr> <td><strong>Name</strong></td> <td><strong>Ref No</strong></td> <td><strong>Status</strong></td> <td><strong>Type</strong></td> <td><strong>Date</strong></td> <td><strong>Extend</strong></td> <td><strong>Feature</strong></td> <td><strong>Offer</strong></td> </tr> <tr> <td>".stripslashes($ITEMS["name"])."</td> <td>".stripslashes($ITEMS["ref"])."</td> <td>".stripslashes($ITEMS["status"])."</td> <td>".stripslashes($ITEMS["type"])."</td> <td>".stripslashes($ITEMS["date"])."</td> <td>".$_POST['extend']."</td> <td>".$_POST['feature']."</td> <td>".$_POST['offer']."</td> </tr> </table> "; mail($to, "subject", $msg, $mailheader) or die ("Failure"); mail("me@me.co.uk", "subject", $msg, $mailheader) or die ("Failure"); echo "<br /><br /><font size=2> <strong><center>Thank you!</center><br /> Your details of your request has been sent:</center><br /> "; }; ?> <tr> <td><?php echo stripslashes($ITEMS["name"]); ?></td> <td><?php echo stripslashes($ITEMS["ref"]); ?></td> <td><?php echo stripslashes($ITEMS["status"]); ?></td> <td><?php echo stripslashes($ITEMS["type"]); ?></td> <td><?php echo stripslashes($ITEMS["date"]); ?></td> <td><input type="radio" name="extend<?php echo stripslashes($ITEMS["id"]); ?>" value="No"> No <input type="radio" name="extend<?php echo stripslashes($ITEMS["id"]); ?>" value="Yes" /> Yes</td> <td><input type="radio" name="featured<?php echo stripslashes($ITEMS["id"]); ?>" value="No"> No <input type="radio" name="featured<?php echo stripslashes($ITEMS["id"]); ?>" value="Yes" /> Yes</td> <td><input type="radio" name="latedeal<?php echo stripslashes($ITEMS["id"]); ?>" value="No"> No <input type="radio" name="latedeal<?php echo stripslashes($ITEMS["id"]); ?>" value="Yes" /> Yes</td> </tr> <?php } ?> <tr> <td> <input type="submit" name="Submit" value="Send"></td> </tr></table> </form> </table> Hi, This is my first post, so hopefully, you'll go easy on me. I'm a serious PHP newbie.. I have an form that calls a .php file. The php file is supposed to generate an email made up of the captured form fields and redirect the user to a 'thank you' page. The redirect works, but the email is not being generated. Here is my code: Code: [Select] <?PHP putenv("TZ=US/Central"); $time = date("M j, Y, g:i a"); $name = $_POST["name"]; $email = $_POST["email"]; $phone = $_POST["phone"]; $contact = $_POST["contact"]; $destination = $_POST["destination"]; $resort_brand = $_POST["resort_brand"]; $specific_resort = $_POST["specific_resort"]; $specialty_vacation = $_POST["specialty_vacation"]; $cruise_line = $_POST["cruise_line"]; $cruise_destination = $_POST["cruise_destination"]; $cruise_duration = $_POST["cruise_duration"]; $departDate = $_POST["departDate"]; $number_adults = $_POST["number_adults"]; $number_of_nights = $_POST["number_of_nights"]; $number_children = $_POST["number_children"]; $age1 = $_POST["age1"]; $age2 = $_POST["age2"]; $age3 = $_POST["age3"]; $age4 = $_POST["age4"]; $age5 = $_POST["age5"]; $passport = $_POST["passport"]; $handicapped = $_POST["handicapped"]; $comments = $_POST["comments"]; $recipient = "smarshall@stltoday.com, jmcginnis@post-dispatch.com, info@classictravelstl.com"; $subject = "Classic Travel quote request"; $body = "<p><b>Name:</b> $name<p><b>Email:</b> $email<p><b>Phone:</b> $phone<p><b>Contact:</b> $contact<p><b>Destination:</b> $destination<p><b>Resort Brand:</b> $resort_brand<p><b>Specific Resort:</b> $specific_resort<p><b>Specialty Vacation:</b> $specialty_vacation<p><b>Cruise Line:</b> $cruise_line<p><b>Cruise Destination:</b> $cruise_destination<p><b>Cruise Duration:</b> $cruise_duration<p><b>Departure Date:</b> $departDate<p><b>Number of Adults:</b> $number_adults<p><b>Number of Nights:</b> $number_of_nights<p><b>Number of Children:</b> $number_children<p><b>Age1:</b> $age1<p><b>Age2:</b> $age2<p><b>Age3:</b> $age3<p><b>Age4:</b> $age4<p><b>Age5:</b> $age5<p><b>Passport:</b> $passport<p><b>Handicapped:</b> $handicapped<p><b>Comments:</b> $comments"; $headers = "From: \"$name\" <$email>\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "X-Mailer: Drupal\n"; $headers .= 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $send = mail($recipient,$subject,$body,$headers); header( "Location: http://dmsgroup.co/classic-travel/thank_you.html" ) ; ?> The form that calls this file is he http://dmsgroup.co/classic-travel/request_info.html It was working at one point, but it's not anymore. Also, when it was working, the "specialty_vacation" field (which is a checkbox) would not pull in any data. Do I need to do something different to access checkboxes? Thanks in advance for your help! SteveMTNO Hello, 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; ?> why cant i login in i have everything in my db this is the code Code: [Select] <?php session_start(); $email= $_SESSION['email']; ?> <?php if(loginbtn){ $email = $_POST['email']; $password = $_POST['password']; if($email && $password){ //connection to db require 'scripts/connect.php'; $query = mysql_query("SELECT * FROM users WHERE email='$email'"); $numrows = mysql_num_rows($query); if($numrows == 0){ $rows = mysql_fetch_assoc($query); $dbemail = $row['email']; $dbpassword = $row['password']; if($password==$dbpassword){ $_SESSION['email'] = $dbemail; echo "You have been logged in as $email"."<br/>"; }else echo "You enter a incorrect password"; }else echo "This person does not exsit"; }else echo "You did not fill in all the fields"; }else echo "$form"; $form = "<form action='login.php' method='POST'> <table> <tr> <td>Email</td> <td><input type='email' name='email'></td> </tr> <tr> <td>Password</td> <td><input type='password' name='password'></td> </tr> <tr> <td></td> <td><input type='submit' name='loginbtn' value='Login'></td> </tr> </table> </form>"; echo $form; ?> Hey folks, this is a demo of my cart htp://fhcs.be/cart-demo3/ I have made a send button and a mail.php , but I dont receive the mail although it says that the email is sent. Here is my mail.php <?php if($_POST['sendemail'] == 'Email') { mail('andrej13@gmail.com', 'Subject', $cart); echo 'Your mail has been sent'; } else { echo 'Your mail was not sent'; } ?> my cart.php (where the email button is) <?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> <form action="mail.php" method="post"> <input type="submit" name="sendemail" value="Email" /> </form> </div> </body> </html> and the functions.inc.php <?php function writeShoppingCart() { $cart = $_SESSION['cart']; if (!$cart) { return '<p>You have no items in your shopping cart</p>'; } else { // Parse the cart session variable $items = explode(',',$cart); $s = (count($items) > 1) ? 's':''; return '<p>You have <a href="cart.php">'.count($items).' item'.$s.' in your shopping cart</a></p>'; } } function showCart() { global $db; $cart = $_SESSION['cart']; if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items as $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } $output[] = '<form action="cart.php?action=update" method="post" id="cart">'; $output[] = '<table>'; foreach ($contents as $id=>$qty) { $sql = 'SELECT * FROM products WHERE id = '.$id; $result = $db->query($sql); $row = $result->fetch(); extract($row); $output[] = '<tr>'; $output[] = '<td><a href="cart.php?action=delete&id='.$id.'" class="r">Remove</a></td>'; $output[] = '<td>'.$name.'</td>'; $output[] = '<td>€'.$price.'</td>'; $output[] = '<td><input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" /></td>'; $output[] = '<td>€'.($price * $qty).'</td>'; $total += $price * $qty; $output[] = '</tr>'; } $output[] = '</table>'; $output[] = '<p>Grand total: <strong>£'.$total.'</strong></p>'; $output[] = '<div><button type="submit">Update cart</button></div>'; $output[] = '</form>'; } else { $output[] = '<p>You shopping cart is empty.</p>'; } return join('',$output); } ?> Hi, I need to send a html image as an email to people. Here is the link http://cs.txstate.edu/~sr1388/Test/.. When I send I send the email by copying the source code(from view source) of that page, everything looks the same except for the fact the registry and review tables dont get aligned side by side . I cannot find what issue is causing it. This is what my email function looks like: Code: [Select] <? $content='view-source code here'; echo $content; $to = "me@gmail.com"; $subject = "test"; $body=$content; //$body="hello"; //$message=$total; $from = "webmaster@example.com"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; //$headers .= 'X-Mailer: PHP/' . phpversion() . "\r\n"; $headers .= 'From: Admin <Admin@mysite.com>' . "\r\n"; // Send email if(mail($to,$subject,$body,$headers)) { // Inform the user echo "Your email has been sent"; } else { echo "MAIL not sent"; } ?> i have some code which sends a confrim link via the posted email. In hotmail it works fine, once the link is clicked they are confirmed but gmail adds %09 to the link making it break. example WHERE hash = their email hashed posted email = test@test.com confirm link(hotmail) confirm.php?email=HASH&o=test@test.com(works) confirm link(gmail)confirm.php?email=%09HASH&o=test@test.com(Doesnt work) anyone know why gmail does this? I still have little knowledge of php, I asked a question earlier but that gave me so as it is now my help please. I'm looking for an easy script that sends the info and send a confirmation. but everyone says something different. Have you a script that I only need to change what data? before hand thanks now use this script but does not work also completely leak, I understood for spammmers Ok, I submit the form, and when the next page displays, it says recieved with the persons name, but it wont post their email, and it wont ever send the message to the email address......... i've been playing with it all day long and just cannot figure it out, about to rip my hair out... any help would be appreciated. Contact.php page Code: [Select] <?php // Header Include include('includes/header.php'); ?> <!-- BEGIN SITE CONTENT INCLUDES HERE --> <!-- Index page included --> <table border="0" cellpadding="5" cellspacing="0" width="300" align="center"> <tr> <td><font face="verdana" size="2" color=#"000000"><b>Feedback Form</b></font></td> <tr> <td><form name="contact" method="post" action="contact_submit.php"> <font face="verdana" size="1" color="#1b4a1b">Your Name:<br /> <input type="text" name="name" size="25" /> <br /> Email:<br /> <input type="text" name"email" size="25" /> <br /> Comments:</font><br /> <textarea name="comments" rows="5" cols="30"></textarea> <br /><input type="submit" name="submit" value="Send" /> </form></td> </tr> </table> <br /><br /> <!-- / End Index Page --> <!-- / END SITE CONTENT INCLUDES HERE --> <!-- Footer Include --> <?php include('includes/footer.php'); ?> Form Processing Script contact_submit.php Code: [Select] <?php $to = "tonyagmatrix@gmail.com"; $re = "Feedback Form"; $msg = $comments; mail($to,$re,$msg); ?> <html><head><title>Message Recieved</title></head> <body> <h3>Thank you for your feedback <?PHP echo ($name); ?></h3> <br />We value your opinions and any questions will be replyed to your email address: <?php echo ($email); ?> </body></html> Does anyone have any idea wtf is wrong? 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! Hi, Im sort of new to PHP. I currently have this code Code: [Select] if(!empty($myrow['email'])){ echo "<a href=\"mailto: ".$myrow['email']."\">".$myrow['email']; echo "</a><br>";}Which just displays a email from the database and when clicked opens Outlook or some other email program. What i'm trying to do is hide the email and in its place put a link like "Contact" or a simple form that would send a email from my website to that email address. Does any one know any links to tutorials or at least a name for a script that would allow me to do this? Cheers! 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] I can get "Name" etc to show on the email but not the value. eg: Name: What I need is Name: Joe Smith Here is the code: <?php if($_POST["submit"]) { $recipient="my@email.address"; $subject="Form to email message"; $sender=$cemail; $mailBody="Customers Business Name: $cbname\n $cname=Customers Name: $cname\n $caddress=Customers Address: $caddress\n $csuburb=Customers Suburb: $csuburb\n $ccity=Customers City: $ccity\n $cphone=Customers Phone Number: $cphone\n $cemail=Customers Email: $cemail\n\n $sbname=Senders Business Name: $sbname\n $sname=Senders Name: $sname\n $saddress=Senders Address: $saddress\n $ssuburb=Senders Suburb: $ssuburb\n $scity=Senders City: $scity\n $sphone=Senders Phone Number: $sphone\n\n $rbname=Receivers Business Name: $rbname\n $rname=Receivers Name: $rname\n $raddress=Receivers Address: $raddress\n $rsuburb=Receivers Suburb: $rsuburb\n $rcity=Receivers City: $rcity\n $rphone=Receivers Phone Number: $rphone\n\n $item=Item: $item\n $length=Length: $length\n $width=Width: $width\n $height=height: \n\n $message=Additional Information: "$message; mail($recipient, $subject, $mailBody, "From: $sender <$cemail>"); header('Location: thanks.php'); } ?> Here is the form <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Contact form to email</title> </head> <body> <form method="post" action="action.php"> <label>Customers Business Name:</label> <input name="cbname"><br> <label>Customers Name:</label> <input name="cname"><br> <label>Cusotmers Address:</label> <input name="caddress"><br> <label>Customers Suburb:</label> <input name="csuburb"><br> <label>Customers City:</label> <input name="ccity"><br> <label>Customers Phone Number:</label> <input name="cphone"><br> <label>Customers Email:</label> <input name="cemail"><br> <label>Senders Business Name:</label> <input name="sbname"><br> <label>Senders Name:</label> <input name="sname"><br> <label>Senders Address:</label> <input name="saddress"><br> <label>Senders Suburb:</label> <input name="ssuburb"><br> <label>Senders City:</label> <input name="scity"><br> <label>Senders Phone Number:</label> <input name="sphone"><br> <label>Receivers Business Name:</label> <input name="rbname"><br> <label>Receivers Name:</label> <input name="rname"><br> <label>Receivers Address:</label> <input name="raddress"><br> <label>Receivers Suburb:</label> <input name="rsuburb"><br> <label>Receivers City:</label> <input name="rcity"><br> <label>Receivers Phone Number:</label> <input name="rphone"><br> <label>Item:</label> <input name="item"><br> <label>Length in cm:</label> <input name="length"><br> <label>Width in cm:</label> <input name="width"><br> <label>Height in cm:</label> <input name="hight"><br> <label>Weight in kg:</label> <input name="weight"><br> <label>Additional Information:</label> <textarea rows="5" cols="20" name="info"></textarea> <input type="submit" name="submit"> </form> </body> </html> Thanks for any help for can give. 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> Hi all, My names Mike and i am currently working on a website for my University degree but have encountered a problem when creating an email form. I have the following form below which i have created via a tutorial but it's not working i just dont recieve any emails. I would really appreciate it if someone could take a look at this for me. I must stress i am new to PHP as well. The email form just needs to state who it comes from as well as an email address and subject. code below: Code: [Select] <html> <body> <?php if (isset($_REQUEST['email'])) //if "email" is filled out, send email { //send email $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail("mike2fast135@hotmail.com", "$subject", $message, "From:" . $email); echo "Thank you for using our mail form"; } else //if "email" is not filled out, display the form { echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text' /><br /> Subject: <input name='subject' type='text' /><br /> Message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; } ?> </body> </html> Thanks for any help or guidance. Mike First I am not a developer. I am just trying to reverse engineer the existing php form. This is the test page that I have setup. http://www.absenteehomeowners.com/arrival/index-test.php Currently the form emails the form information to a specific email address. I am trying to add the function of where if the user provides an email address then the information is also sent to the user. Here are the pages that I think are involved. |