"...Remember being a youngster, mom or dad telling you "close the door"? Well the same applies to HTML ...."

Go Back   Webmaster Forums > Code Forum > PHP Forum

Reply
 
Thread Tools Rate this Webmaster Discussion
Old 09-28-2009, 12:54 PM   #1
adamsen
Senior Member
 
adamsen's Avatar
 
Join Date: Jan 2009
Location: Denmark
Webmaster Discussions: 128
Rep Power: 11
adamsen will become famous soon enough
Problem with mail-script

I´ve made a form which should be able to send me some informations.
On the internet I found a PHP-script that could help me with
that, but it doesn´t work. When you press the Send-button, I recive an email, but it doesn´t have any content. I hope someone can see what is wrong:

Html:
HTML Code:
<form method="post" action="../../php/mail_phpscript.php" enctype="text/plain" name="bestilling">
Hus/værelse:<br>
<input type="text" name="Hus"
value="Det store hus, soveværelset" size="25" readonly="readonly">
<br><br>
Reserverede datoer:<br>
<input type="text" name="datoer" size="25" id="datoer">
<br><br>
Navn/familie:<br>
<input type="text" name="navn" size="20">
<br><br>
Email:<br>
<input type="text" name="email" size="20">
<br><br>
Telefonnummer:<br>
<input type="text" name="fasttlf" size="20">
<br><br>
<input type="submit" value="Send"></form>
PHP:
PHP Code:
<?php
/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$email 'EMAIL REMOVED';
$subject 'Email-tilmelding';
$message $HTTP_POST_VARS['datoer'];

/* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/"$email)) {
  echo 
"<h4>Invalid email address</h4>";
  echo 
"<a href='javascript:history.back(1);'>Back</a>";
} elseif (
$subject == "") {
  echo 
"<h4>No subject</h4>";
  echo 
"<a href='javascript:history.back(1);'>Back</a>";
}

/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
elseif (mail($email,$subject,$message)) {
  echo 
"<center><h1>Informationerne er sendt</h1></center>";
} else {
  echo 
"<h4>Fejl</h4>";
}
?>
All this is uploaded on:

http://www.ullilo.dk/reservering/storehus_sovevaerelse/recieve.html


__________________
W3schools
Practice makes expert
adamsen is offline   Reply With Quote
Reply

Bookmarks

Tags
mailscript

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Webmaster Discussions
Thread Webmaster Discussion Starter Forum Replies Last Post
Php Mail script being Spammed richybear PHP Forum 7 04-27-2007 06:19 AM
PHP Form Mail Problem FrozenGecko PHP Forum 30 10-13-2005 06:15 AM
problem with function mail() ovello PHP Forum 6 01-11-2005 07:52 AM
Send Mail Problem WJam CGI Perl Forum 11 12-08-2003 11:22 PM
php mail script help Derek PHP Forum 14 12-01-2003 02:23 PM


All times are GMT -5. The time now is 08:59 PM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.