I need a contact form. Very simple. I only need 3 fields: name type: (i need a drop down type1, 2 and 3) message: (text area) and a submit button and thats it . In return free hosting.
Dude do a quick search on Google, it'll only take you seconds. http://www.google.com/search?hl=en&...window=1&q=contact+form+html&aq=f&aqi=g10&oq=
Well actually there are very neat generators, but i also need a drop menu. I cant find a generator that does that. - prilep
I just found this product which sells for 7 bucks, looks very cool. http://activeden.net/item/dynamic-contact-form/10697
This forum is for php help, not php demands. If you need it you'd post in the BST and hire someone, or learn php to do it yourself, learning yourself is much more rewarding. Untested, but this should work: <?php function clean($input) { //basic security function, to prevent spam etc... return str_replace(array("content-type", "bcc:", "to:", "cc:", "href"), "", strip_tags($input)); } //check if form is submitted, and ALL fields are not empty if (isset($_POST['submit']) && !empty($_POST['name']) && !empty($_POST['message']) && !empty($_POST['type'])) { //your email - where the contact form data will be emailed too... $email = "you@domain.com"; $subject = "Contact Form"; $message = "Message: " . clean($_POST['message']) . "\n"; $message .= "Name: " . clean($POST['name']) . "\n"; $message .= "Type: " . clean($POST['type']); $valid = true; } ?> <form method="post"> Name: <br /> <input type="text" name="name"><br /><br /> Type: <br /> <select name="type"> <option value="Type1">Type1</option> <option value="Type2">Type2</option> <option value="Type3">Type3</option> </select><br /><br /> Message:<br /> <textarea name="message" rows="6" cols="50"></textarea><br /><br /> <input type="submit" name="submit" value="Submit"> </form> <?php if (@$valid == true && mail($email, $subject, $message)) { echo "Mail Sent"; } ?> PHP: I don't need the hosting...
Strange, try to not use clean() function, if still problem try to replace clean($_POST['message']) by clean($POST['name']) just for one reason: check if you get the name after "Message:" or it is blank, then let me know so I can help you.
Woops typo, use this: <?php function clean($input) { //basic security function, to prevent spam etc... return str_replace(array("content-type", "bcc:", "to:", "cc:", "href"), "", strip_tags($input)); } //check if form is submitted, and ALL fields are not empty if (isset($_POST['submit']) && !empty($_POST['name']) && !empty($_POST['message']) && !empty($_POST['type'])) { //your email - where the contact form data will be emailed too... $email = "you@domain.com"; $subject = "Contact Form"; $message = "Message: " . clean($_POST['message']) . "\n"; $message .= "Name: " . clean($_POST['name']) . "\n"; $message .= "Type: " . clean($_POST['type']); $valid = true; } ?> <form method="post"> Name: <br /> <input type="text" name="name" /><br /><br /> Type: <br /> <select name="type"> <option value="Type1">Type1</option> <option value="Type2">Type2</option> <option value="Type3">Type3</option> </select><br /><br /> Message:<br /> <textarea name="message" rows="6" cols="50"></textarea><br /><br /> <input type="submit" name="submit" value="Submit" /> </form> <?php if (@$valid == true && mail($email, $subject, $message)) { echo "Mail Sent"; } ?> PHP: