HTML 5 form which send infos in a PHP e-mail
I would use some help because I don't know what to do at all...
I created an HTML form (which isn't a problem) :
<form method="post" action="form-page.php" class="cta">
<div class="row gtr-uniform gtr-50">
<div class="col-8 col-12-xsmall"><input type="text" name="user_name" id="name" required placeholder="Votre nom"></div>
<div class="col-8 col-12-xsmall"><input type="email" name="email" id="email" placeholder="Votre adresse e-mail" /></div>
<div class="col-8 col-12-xsmall"><textarea name="user_message" id="msg" required placeholder="Votre message"></textarea></div>
<div class="col-4 col-12-xsmall"><input type="submit" value="Envoyer." class="fit primary" /></div>
</div>
</form>
I created the file "form-page.php" which treat the form with this code :
<?php
// We get the infos of the form
$user_name = $_POST['user_name']; // Nom / Pseudo.
$email = $_POST['email']; // e-mail.
$user_message = $_POST['user_message']; // Message.
//=========
// We put the adress where the mail is going to be send.
//P.S : "myemail@gmail.com" isn't MY email, I just put it here to hide my email :)
$mail = 'myemail@gmail.com';
//=========
// We filtrate servers to avoid bugs.
if (!preg_match("#^[a-z0-9._-]+@(hotmail|live|msn).[a-z]{2,4}$#", $mail))
{
$passage_ligne = "rn";
}
else
{
$passage_ligne = "n";
}
//=========
// We define the subject of the mail.
$sujet = "Suggestion ou bug de ton site, Pokemon Reality";
//=========
// We create the header of the email.
$header = "From: "$user_name" $email".$passage_ligne;
$header.= "MIME-Version: 1.0".$passage_ligne;
//==========
// We create the message.
$message = $user_message;
//==========
// Finally, we send the email.
mail($mail,$sujet,$message,$header);
//==========
?>
Buuuut... This doesn't work! After I press the button "Envoyer." of the form, I wait while the page is loading and I see an error :
ERROR
ERROR2
I didn't touch to anything, and before that, I test it 3 times, and it send the mail, but there was a blank page.
So I want to fix the error, and then, I want to redirect the user to the form and say "Thank You !".
Thanks for your help!
php html forms email send
|
show 1 more comment
I would use some help because I don't know what to do at all...
I created an HTML form (which isn't a problem) :
<form method="post" action="form-page.php" class="cta">
<div class="row gtr-uniform gtr-50">
<div class="col-8 col-12-xsmall"><input type="text" name="user_name" id="name" required placeholder="Votre nom"></div>
<div class="col-8 col-12-xsmall"><input type="email" name="email" id="email" placeholder="Votre adresse e-mail" /></div>
<div class="col-8 col-12-xsmall"><textarea name="user_message" id="msg" required placeholder="Votre message"></textarea></div>
<div class="col-4 col-12-xsmall"><input type="submit" value="Envoyer." class="fit primary" /></div>
</div>
</form>
I created the file "form-page.php" which treat the form with this code :
<?php
// We get the infos of the form
$user_name = $_POST['user_name']; // Nom / Pseudo.
$email = $_POST['email']; // e-mail.
$user_message = $_POST['user_message']; // Message.
//=========
// We put the adress where the mail is going to be send.
//P.S : "myemail@gmail.com" isn't MY email, I just put it here to hide my email :)
$mail = 'myemail@gmail.com';
//=========
// We filtrate servers to avoid bugs.
if (!preg_match("#^[a-z0-9._-]+@(hotmail|live|msn).[a-z]{2,4}$#", $mail))
{
$passage_ligne = "rn";
}
else
{
$passage_ligne = "n";
}
//=========
// We define the subject of the mail.
$sujet = "Suggestion ou bug de ton site, Pokemon Reality";
//=========
// We create the header of the email.
$header = "From: "$user_name" $email".$passage_ligne;
$header.= "MIME-Version: 1.0".$passage_ligne;
//==========
// We create the message.
$message = $user_message;
//==========
// Finally, we send the email.
mail($mail,$sujet,$message,$header);
//==========
?>
Buuuut... This doesn't work! After I press the button "Envoyer." of the form, I wait while the page is loading and I see an error :
ERROR
ERROR2
I didn't touch to anything, and before that, I test it 3 times, and it send the mail, but there was a blank page.
So I want to fix the error, and then, I want to redirect the user to the form and say "Thank You !".
Thanks for your help!
php html forms email send
"I see an error" Do you expect us to guess what error you see?
– u_mulder
Nov 17 '18 at 14:44
what is your main issue? is it "not able to send mail " or "How to redirect user"?
– RopAli Munshi
Nov 17 '18 at 14:48
RopAli Munshi it's both, I want to fix the problem of the email, and then, redirect the user because before, when it worked, I saw a blank page...
– Max094 Reikeb
Nov 17 '18 at 14:50
Here's the error I see : [link]noelshack.com/2018-46-6-1542466205-error.png[/link] It's just a blank page with those words...
– Max094 Reikeb
Nov 17 '18 at 14:50
And when I inspect the element, I see that error : [link]image.noelshack.com/fichiers/2018/46/6/…
– Max094 Reikeb
Nov 17 '18 at 14:52
|
show 1 more comment
I would use some help because I don't know what to do at all...
I created an HTML form (which isn't a problem) :
<form method="post" action="form-page.php" class="cta">
<div class="row gtr-uniform gtr-50">
<div class="col-8 col-12-xsmall"><input type="text" name="user_name" id="name" required placeholder="Votre nom"></div>
<div class="col-8 col-12-xsmall"><input type="email" name="email" id="email" placeholder="Votre adresse e-mail" /></div>
<div class="col-8 col-12-xsmall"><textarea name="user_message" id="msg" required placeholder="Votre message"></textarea></div>
<div class="col-4 col-12-xsmall"><input type="submit" value="Envoyer." class="fit primary" /></div>
</div>
</form>
I created the file "form-page.php" which treat the form with this code :
<?php
// We get the infos of the form
$user_name = $_POST['user_name']; // Nom / Pseudo.
$email = $_POST['email']; // e-mail.
$user_message = $_POST['user_message']; // Message.
//=========
// We put the adress where the mail is going to be send.
//P.S : "myemail@gmail.com" isn't MY email, I just put it here to hide my email :)
$mail = 'myemail@gmail.com';
//=========
// We filtrate servers to avoid bugs.
if (!preg_match("#^[a-z0-9._-]+@(hotmail|live|msn).[a-z]{2,4}$#", $mail))
{
$passage_ligne = "rn";
}
else
{
$passage_ligne = "n";
}
//=========
// We define the subject of the mail.
$sujet = "Suggestion ou bug de ton site, Pokemon Reality";
//=========
// We create the header of the email.
$header = "From: "$user_name" $email".$passage_ligne;
$header.= "MIME-Version: 1.0".$passage_ligne;
//==========
// We create the message.
$message = $user_message;
//==========
// Finally, we send the email.
mail($mail,$sujet,$message,$header);
//==========
?>
Buuuut... This doesn't work! After I press the button "Envoyer." of the form, I wait while the page is loading and I see an error :
ERROR
ERROR2
I didn't touch to anything, and before that, I test it 3 times, and it send the mail, but there was a blank page.
So I want to fix the error, and then, I want to redirect the user to the form and say "Thank You !".
Thanks for your help!
php html forms email send
I would use some help because I don't know what to do at all...
I created an HTML form (which isn't a problem) :
<form method="post" action="form-page.php" class="cta">
<div class="row gtr-uniform gtr-50">
<div class="col-8 col-12-xsmall"><input type="text" name="user_name" id="name" required placeholder="Votre nom"></div>
<div class="col-8 col-12-xsmall"><input type="email" name="email" id="email" placeholder="Votre adresse e-mail" /></div>
<div class="col-8 col-12-xsmall"><textarea name="user_message" id="msg" required placeholder="Votre message"></textarea></div>
<div class="col-4 col-12-xsmall"><input type="submit" value="Envoyer." class="fit primary" /></div>
</div>
</form>
I created the file "form-page.php" which treat the form with this code :
<?php
// We get the infos of the form
$user_name = $_POST['user_name']; // Nom / Pseudo.
$email = $_POST['email']; // e-mail.
$user_message = $_POST['user_message']; // Message.
//=========
// We put the adress where the mail is going to be send.
//P.S : "myemail@gmail.com" isn't MY email, I just put it here to hide my email :)
$mail = 'myemail@gmail.com';
//=========
// We filtrate servers to avoid bugs.
if (!preg_match("#^[a-z0-9._-]+@(hotmail|live|msn).[a-z]{2,4}$#", $mail))
{
$passage_ligne = "rn";
}
else
{
$passage_ligne = "n";
}
//=========
// We define the subject of the mail.
$sujet = "Suggestion ou bug de ton site, Pokemon Reality";
//=========
// We create the header of the email.
$header = "From: "$user_name" $email".$passage_ligne;
$header.= "MIME-Version: 1.0".$passage_ligne;
//==========
// We create the message.
$message = $user_message;
//==========
// Finally, we send the email.
mail($mail,$sujet,$message,$header);
//==========
?>
Buuuut... This doesn't work! After I press the button "Envoyer." of the form, I wait while the page is loading and I see an error :
ERROR
ERROR2
I didn't touch to anything, and before that, I test it 3 times, and it send the mail, but there was a blank page.
So I want to fix the error, and then, I want to redirect the user to the form and say "Thank You !".
Thanks for your help!
php html forms email send
php html forms email send
edited Nov 17 '18 at 15:46
Max094 Reikeb
asked Nov 17 '18 at 14:42
Max094 ReikebMax094 Reikeb
64
64
"I see an error" Do you expect us to guess what error you see?
– u_mulder
Nov 17 '18 at 14:44
what is your main issue? is it "not able to send mail " or "How to redirect user"?
– RopAli Munshi
Nov 17 '18 at 14:48
RopAli Munshi it's both, I want to fix the problem of the email, and then, redirect the user because before, when it worked, I saw a blank page...
– Max094 Reikeb
Nov 17 '18 at 14:50
Here's the error I see : [link]noelshack.com/2018-46-6-1542466205-error.png[/link] It's just a blank page with those words...
– Max094 Reikeb
Nov 17 '18 at 14:50
And when I inspect the element, I see that error : [link]image.noelshack.com/fichiers/2018/46/6/…
– Max094 Reikeb
Nov 17 '18 at 14:52
|
show 1 more comment
"I see an error" Do you expect us to guess what error you see?
– u_mulder
Nov 17 '18 at 14:44
what is your main issue? is it "not able to send mail " or "How to redirect user"?
– RopAli Munshi
Nov 17 '18 at 14:48
RopAli Munshi it's both, I want to fix the problem of the email, and then, redirect the user because before, when it worked, I saw a blank page...
– Max094 Reikeb
Nov 17 '18 at 14:50
Here's the error I see : [link]noelshack.com/2018-46-6-1542466205-error.png[/link] It's just a blank page with those words...
– Max094 Reikeb
Nov 17 '18 at 14:50
And when I inspect the element, I see that error : [link]image.noelshack.com/fichiers/2018/46/6/…
– Max094 Reikeb
Nov 17 '18 at 14:52
"I see an error" Do you expect us to guess what error you see?
– u_mulder
Nov 17 '18 at 14:44
"I see an error" Do you expect us to guess what error you see?
– u_mulder
Nov 17 '18 at 14:44
what is your main issue? is it "not able to send mail " or "How to redirect user"?
– RopAli Munshi
Nov 17 '18 at 14:48
what is your main issue? is it "not able to send mail " or "How to redirect user"?
– RopAli Munshi
Nov 17 '18 at 14:48
RopAli Munshi it's both, I want to fix the problem of the email, and then, redirect the user because before, when it worked, I saw a blank page...
– Max094 Reikeb
Nov 17 '18 at 14:50
RopAli Munshi it's both, I want to fix the problem of the email, and then, redirect the user because before, when it worked, I saw a blank page...
– Max094 Reikeb
Nov 17 '18 at 14:50
Here's the error I see : [link]noelshack.com/2018-46-6-1542466205-error.png[/link] It's just a blank page with those words...
– Max094 Reikeb
Nov 17 '18 at 14:50
Here's the error I see : [link]noelshack.com/2018-46-6-1542466205-error.png[/link] It's just a blank page with those words...
– Max094 Reikeb
Nov 17 '18 at 14:50
And when I inspect the element, I see that error : [link]image.noelshack.com/fichiers/2018/46/6/…
– Max094 Reikeb
Nov 17 '18 at 14:52
And when I inspect the element, I see that error : [link]image.noelshack.com/fichiers/2018/46/6/…
– Max094 Reikeb
Nov 17 '18 at 14:52
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53352264%2fhtml-5-form-which-send-infos-in-a-php-e-mail%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53352264%2fhtml-5-form-which-send-infos-in-a-php-e-mail%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
"I see an error" Do you expect us to guess what error you see?
– u_mulder
Nov 17 '18 at 14:44
what is your main issue? is it "not able to send mail " or "How to redirect user"?
– RopAli Munshi
Nov 17 '18 at 14:48
RopAli Munshi it's both, I want to fix the problem of the email, and then, redirect the user because before, when it worked, I saw a blank page...
– Max094 Reikeb
Nov 17 '18 at 14:50
Here's the error I see : [link]noelshack.com/2018-46-6-1542466205-error.png[/link] It's just a blank page with those words...
– Max094 Reikeb
Nov 17 '18 at 14:50
And when I inspect the element, I see that error : [link]image.noelshack.com/fichiers/2018/46/6/…
– Max094 Reikeb
Nov 17 '18 at 14:52