Gå til innhold

Hvordan lage flere ruter i mailform?


Anbefalte innlegg

Hei.

 

Jeg klarte å få flere ruter i mailformen, men når den blir sendt til e-posten min, kommer resten av rutene unntatt den jeg lagde. Hva er grunnen?

 

Her er koden til mailformen, "blabla" er ny rute!

Koden til blabla ruten er:

<label for="blabla">Bla Bla</label>

<input id="blabla" name="blabla" type="text" size="30" maxlength="40"

 

Så hva skal jeg gjöre sånn at blabla ruten fölger med på e-posten?

 

<?php

/**********************************/
/*	   EMAIL CONTACT FORM	   */
/*		  VERSION 1.1		   */
/* Copyright 2004 (c) Epleweb.com */
/**********************************/

/*	GNU General Public License
--------------------------------------------------------------------
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 2 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.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

if ($_POST['submit'] == TRUE) {
$receiverMail = "[email protected]";
$name		= stripslashes(strip_tags($_POST['name']));
$email		= stripslashes(strip_tags($_POST['email']));
$subject	= stripslashes(strip_tags($_POST['subject']));
$msg		= stripslashes(strip_tags($_POST['msg']));
$ip			= $_SERVER['REMOTE_ADDR'];
$msgformat	= "From: $name ($ip)\nEmail: $email\n\n$msg";

if(empty($name) || empty($email) || empty($subject) || empty($msg)) {
	echo "<h2>The email was not sent</h2><p>Please fill all the required fields</p>";
}
elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
	echo "<h2>The email was not sent</h2><p>The email address is invalid</p>";
}
elseif(mail($receiverMail, $subject, $msgformat, "From: $name <$email>")) {
	echo "<h2>The email has been sent!</h2><p>I will get back to you as soon as possible.</p>"; }
else {
	echo "<h2>The email was not sent</h2><p>Please try again... If the problem continues there's probably something wrong with the server.</p>";
}
}
else { ?>
<form method="post" action="">
<p>
<label for="name">Name</label>
<input id="name" name="name" type="text" size="30" maxlength="40" /><br />

<label for="email">Email</label>
<input id="email" name="email" type="text" size="30" maxlength="40" /><br />

<label for="subject">Subject</label>
<input id="subject" name="subject" type="text" size="30" maxlength="40" /><br />

   <label for="blabla">Bla Bla</label>
	<input id="blabla" name="blabla" type="text" size="30" maxlength="40"

<label for="message">Message</label>
<textarea id="message" name="msg" cols="50" rows="6"></textarea><br />

<label for="submit"> </label>
<input id="submit" class="button" type="submit" name="submit" value="Send" />
</p>
</form>
<?php } ?>

Endret av Fight4Lov3
Lenke til kommentar
Videoannonse
Annonse

Trur dette skal fungere:

 

 

 

<?php

/**********************************/
/*	   EMAIL CONTACT FORM	   */
/*		  VERSION 1.1		   */
/* Copyright 2004 (c) Epleweb.com */
/**********************************/

/*	GNU General Public License
--------------------------------------------------------------------
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 2 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.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

if ($_POST['submit'] == TRUE) {
$receiverMail = "[email protected]";
$name		= stripslashes(strip_tags($_POST['name']));
$email		= stripslashes(strip_tags($_POST['email']));
$subject	= stripslashes(strip_tags($_POST['subject']));
$msg		= stripslashes(strip_tags($_POST['msg']));
$ip			= $_SERVER['REMOTE_ADDR'];
$blabla = $_POST['blabla'];
$msgformat	= "From: $name ($ip)\nEmail: $email\n\n$msg\n\n$blabla";


if(empty($name) || empty($email) || empty($subject) || empty($msg) || empty($blabla)) {
	echo "<h2>The email was not sent</h2><p>Please fill all the required fields</p>";
}
elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
	echo "<h2>The email was not sent</h2><p>The email address is invalid</p>";
}
elseif(mail($receiverMail, $subject, $msgformat, "From: $name <$email>")) {
	echo "<h2>The email has been sent!</h2><p>I will get back to you as soon as possible.</p>"; }
else {
	echo "<h2>The email was not sent</h2><p>Please try again... If the problem continues there's probably something wrong with the server.</p>";
}
}
else { ?>
<form method="post" action="">
<p>
<label for="name">Name</label>
<input id="name" name="name" type="text" size="30" maxlength="40" /><br />

<label for="email">Email</label>
<input id="email" name="email" type="text" size="30" maxlength="40" /><br />

<label for="subject">Subject</label>
<input id="subject" name="subject" type="text" size="30" maxlength="40" /><br />

   <label for="blabla">Bla Bla</label>
	<input id="blabla" name="blabla" type="text" size="30" maxlength="40"

<label for="message">Message</label>
<textarea id="message" name="msg" cols="50" rows="6"></textarea><br />

<label for="submit"> </label>
<input id="submit" class="button" type="submit" name="submit" value="Send" />
</p>
</form>
<?php } ?>

 

 

Endret av creAtiive
Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...