October 13, 201313 yr I got this : I want when someone clicks the submit button to sent informations to an email. So after he complete full name,last name,street adress , those details to be sent on specific email. I am using html and probably i need php or something like that? <form action=""> </form>
October 13, 201313 yr I'm not the most qualified here to answer your question but I'm not known to let that hold me back so here's my answer: Yes you will need some sort of scripting language to do this. If your server supports php (standard apache/unix server) that would be a good choice. You will need to add a method attribute to your form tag (to send the values to a processing script) and an action attribute as well (Specifies the location processing script). You will then need a unique id or name for each form input. When the user press the submit button the browser will go to the processing php page and the values from the form inputs will be passed along. In this link you can see how to store the transfered data as variables in your php process file: http://www.w3schools.com/php/php_forms.asp The last step is to use the php mail() function to send the email with the required varibles as parameters. That's the usual procedure to hande mail forms so i hope you can work it out. If not then cunsult the php manual or ask us here on your favorite forum.
October 14, 201313 yr apart from nillervision tips have a look at this thread that will give u idea how contact forms are coded
October 14, 201313 yr Sash has given a good link to ready-made forms. You could also use one from an online source like http://jemsmailform.com/ or http://www.emailmeform.com/ Security measures have been built in to most of the form builders you fing online. Remember that you probably won't be able to send an email from the page on your local computer as the php.ini file needs editing which can be difficult for a beginner, so upload to your server and test the form from your online page like another user would do, (using your hosting service php.ini file).
October 14, 201313 yr Author None of them working i dont know why .Here is a video: http://www.screenr.com/umuH Here is the code: <?php // OPTIONS - PLEASE CONFIGURE THESE BEFORE USE! $yourEmail = "mymucommunity@hotmail.com"; // the email address you wish to receive these mails through $yourWebsite = "WEBSITE NAME"; // the name of your website $thanksPage = ''; // URL to 'thanks for sending mail' page; leave empty to keep message on the same page $maxPoints = 4; // max points a person can hit before it refuses to submit - recommend 4 $requiredFields = "name,email,comments"; // names of the fields you'd like to be required as a minimum, separate each field with a comma // DO NOT EDIT BELOW HERE $error_msg = array(); $result = null; $requiredFields = explode(",", $requiredFields); function clean($data) { $data = trim(stripslashes(strip_tags($data))); return $data; } function isBot() { $bots = array("Indy", "Blaiz", "Java", "libwww-perl", "Python", "OutfoxBot", "User-Agent", "PycURL", "AlphaServer", "T8Abot", "Syntryx", "WinHttp", "WebBandit", "nicebot", "Teoma", "alexa", "froogle", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory", "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot", "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz"); foreach ($bots as $bot) if (stripos($_SERVER['HTTP_USER_AGENT'], $bot) !== false) return true; if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == " ") return true; return false; } if ($_SERVER['REQUEST_METHOD'] == "POST") { if (isBot() !== false) $error_msg[] = "No bots please! UA reported as: ".$_SERVER['HTTP_USER_AGENT']; // lets check a few things - not enough to trigger an error on their own, but worth assigning a spam score.. // score quickly adds up therefore allowing genuine users with 'accidental' score through but cutting out real spam $points = (int)0; $badwords = array("adult", "beastial", "bestial", "blowjob", "clit", "cum", "cunilingus", "cunillingus", "cunnilingus", "****", "ejaculate", "fag", "felatio", "fellatio", "****", "fuk", "fuks", "gangbang", "gangbanged", "gangbangs", "hotsex", "hardcode", "jism", "jiz", "orgasim", "orgasims", "orgasm", "orgasms", "phonesex", "phuk", "phuq", "pussies", "pussy", "spunk", "xxx", "viagra", "phentermine", "tramadol", "adipex", "advai", "alprazolam", "ambien", "ambian", "amoxicillin", "antivert", "blackjack", "backgammon", "texas", "holdem", "poker", "carisoprodol", "ciara", "ciprofloxacin", "debt", "dating", "porn", "link=", "voyeur", "content-type", "bcc:", "cc:", "document.cookie", "onclick", "onload", "javascript"); foreach ($badwords as $word) if ( strpos(strtolower($_POST['comments']), $word) !== false || strpos(strtolower($_POST['name']), $word) !== false ) $points += 2; if (strpos($_POST['comments'], "http://") !== false || strpos($_POST['comments'], "www.") !== false) $points += 2; if (isset($_POST['nojs'])) $points += 1; if (preg_match("/(<.*>)/i", $_POST['comments'])) $points += 2; if (strlen($_POST['name']) < 3) $points += 1; if (strlen($_POST['comments']) < 15 || strlen($_POST['comments'] > 1500)) $points += 2; if (preg_match("/[bcdfghjklmnpqrstvwxyz]{7,}/i", $_POST['comments'])) $points += 1; // end score assignments foreach($requiredFields as $field) { trim($_POST[$field]); if (!isset($_POST[$field]) || empty($_POST[$field]) && array_pop($error_msg) != "Please fill in all the required fields and submit again.\r\n") $error_msg[] = "Please fill in all the required fields and submit again."; } if (!empty($_POST['name']) && !preg_match("/^[a-zA-Z-'\s]*$/", stripslashes($_POST['name']))) $error_msg[] = "The name field must not contain special characters.\r\n"; if (!empty($_POST['email']) && !preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i', strtolower($_POST['email']))) $error_msg[] = "That is not a valid e-mail address.\r\n"; if (!empty($_POST['url']) && !preg_match('/^(http|https):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(\d+))?\/?/i', $_POST['url'])) $error_msg[] = "Invalid website url.\r\n"; if ($error_msg == NULL && $points <= $maxPoints) { $subject = "Automatic Form Email"; $message = "You received this e-mail message through your website: \n\n"; foreach ($_POST as $key => $val) { if (is_array($val)) { foreach ($val as $subval) { $message .= ucwords($key) . ": " . clean($subval) . "\r\n"; } } else { $message .= ucwords($key) . ": " . clean($val) . "\r\n"; } } $message .= "\r\n"; $message .= 'IP: '.$_SERVER['REMOTE_ADDR']."\r\n"; $message .= 'Browser: '.$_SERVER['HTTP_USER_AGENT']."\r\n"; $message .= 'Points: '.$points; if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) { $headers = "From: $yourEmail\n"; $headers .= "Reply-To: {$_POST['email']}"; } else { $headers = "From: $yourWebsite <$yourEmail>\n"; $headers .= "Reply-To: {$_POST['email']}"; } if (mail($yourEmail,$subject,$message,$headers)) { if (!empty($thanksPage)) { header("Location: $thanksPage"); exit; } else { $result = 'Your mail was successfully sent.'; $disable = true; } } else { $error_msg[] = 'Your mail could not be sent this time. ['.$points.']'; } } else { if (empty($error_msg)) $error_msg[] = 'Your mail looks too much like spam, and could not be sent this time. ['.$points.']'; } } function get_data($var) { if (isset($_POST[$var])) echo htmlspecialchars($_POST[$var]); } ?> <!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> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>My Email Form</title> <style type="text/css"> p.error, p.success { font-weight: bold; padding: 10px; border: 1px solid; } p.error { background: #ffc0c0; color: #900; } p.success { background: #b3ff69; color: #4fa000; } </style> </head> <body> <!-- Free PHP Mail Form v2.4.3 - Secure single-page PHP mail form for your website Copyright (c) Jem Turner 2007, 2008, 2010, 2011, 2012 http://jemsmailform.com/ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. To read the GNU General Public License, see http://www.gnu.org/licenses/. --> <?php if (!empty($error_msg)) { echo '<p class="error">ERROR: '. implode("<br />", $error_msg) . "</p>"; } if ($result != NULL) { echo '<p class="success">'. $result . "</p>"; } ?> <form action="<?php echo basename(__FILE__); ?>" method="post"> <noscript> <p><input type="hidden" name="nojs" id="nojs" /></p> </noscript> <p> <label for="name">Name: *</label> <input type="text" name="name" id="name" value="<?php get_data("name"); ?>" /><br /> <label for="email">E-mail: *</label> <input type="text" name="email" id="email" value="<?php get_data("email"); ?>" /><br /> <label for="url">Website URL:</label> <input type="text" name="url" id="url" value="<?php get_data("url"); ?>" /><br /> <label for="location">Location:</label> <input type="text" name="location" id="location" value="<?php get_data("location"); ?>" /><br /> <label for="comments">Comments: *</label> <textarea name="comments" id="comments" rows="5" cols="20"><?php get_data("comments"); ?></textarea><br /> </p> <p> <input type="submit" name="submit" id="submit" value="Send" <?php if (isset($disable) && $disable === true) echo ' disabled="disabled"'; ?> /> </p> </form> <p>Powered by <a href="http://jemsmailform.com/">Jem's PHP Mail Form</a></p> </body> </html> P.S I am using cpanel.
October 16, 201313 yr it works on my server downloaded from here and i tested here you can try using your gmail email instead of hotmail http://youtu.be/ibB0YKZQpK8 Edited October 16, 201313 yr by sash_oo7
October 16, 201313 yr Ask your host (or examine your php.ini / .htacess) to check if there is some mail restrictions on the server
Create an account or sign in to comment