Powered by:
FutureQuest Hosting


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

Web Hosting
Shared       
Reseller     
VPS             
Dedicated 
Price:   $(US)
Space:     (MB)
Transfer:(GB)
Platform:


Advertise
Advertising Opportunities
Rate Card

Sponsor
Go Back   Webmaster Forums > Code Forum > PHP Forum


Reply
 
Thread Tools Rate this Webmaster Discussion
  #1  
Old 09-28-2009, 01:54 PM
adamsen's Avatar
adamsen adamsen is offline
Member
 
Join Date: Jan 2009
Location: Denmark
Webmaster Discussions: 126
Rep Power: 6
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 'michaelhoffadamsen@gmail.com';
$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
Reply With Quote
Reply
Sponsor

Bookmarks

Tags
mailscript

Thread Tools
Rate This Thread
Rate This Thread:

 

Similar Webmaster Discussions
Thread Webmaster Discussion Starter Forum Replies Last Post
Php Mail script being Spammed richybear PHP Forum 7 04-27-2007 07:19 AM
PHP Form Mail Problem FrozenGecko PHP Forum 30 10-13-2005 07: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 06:11 PM.

Copyright © 1999 - 2009 Advanced HTML For Beginners and AHFB2000. All rights reserved.
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.