d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Easy Help With E-mail Form > Php + Html
Add Reply New Topic New Poll
Member
Posts: 6,293
Joined: Aug 25 2013
Gold: 4,079.40
Jan 8 2016 03:56pm
Paying 100 FG to the one that helps me debug or fix this.

This is the code that I have inside the body :

<?php
if(isset($_POST["email"])) {
$ToEmail = 'my-email-goes-here@whatever.com';
$EmailSubject = 'Site contact form';
$mailheader = "From: ".$_POST["email"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$MESSAGE_BODY = "<div>Nom: ".$_POST["name"]."</div>";
$MESSAGE_BODY .= "<div>Courriel: ".$_POST["email"]."</div>";
$MESSAGE_BODY .= "<div>Téléphone: ".$_POST["telephone"]."</div>";
$MESSAGE_BODY .= "<div>Message: ".nl2br($_POST["message"])."</div>";
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");
}
?>


And here is the html to send the e-mail...

<div class="row">
<div class="input-field col s12">
<input id="icon_prefix" type="text" name="name" class="validate">
<label for="icon_prefix">Nom</label>
</div>
<div class="input-field col s12">
<input id="email" type="email" name="email" class="validate">
<label for="email" data-error="wrong" data-success="right">Courriel</label>
</div>
<div class="input-field col s12">
<input id="icon_telephone" name="telephone" type="tel" class="validate">
<label for="icon_telephone">Téléphone</label>
</div>
<div class="input-field col s12">
<textarea id="textarea1" name="message" class="materialize-textarea" length="550"></textarea>
<label for="textarea1">Message</label>
</div>
<div class="input-field col s12" align="center">
<button class="btn-large waves-effect waves-light main-background" type="submit" name="action">
Envoyez
</button>
</div>
</div>

This post was edited by MarcMorrison on Jan 8 2016 03:56pm
Member
Posts: 6,293
Joined: Aug 25 2013
Gold: 4,079.40
Jan 9 2016 03:28pm
Close this please I think I got this figured out on my own and this is too slow anyway I needed kinda-fast help looks like all the gamers of d2jsp none knows how to code properly I thought that was easy job for 100 fg but ok
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jan 9 2016 03:41pm
Quote (MarcMorrison @ Jan 9 2016 04:28pm)
Close this please I think I got this figured out on my own and this is too slow anyway I needed kinda-fast help looks like all the gamers of d2jsp none knows how to code properly I thought that was easy job for 100 fg but ok


We don't do coding here. We mostly talk about games we wish we could make or pretend we know html.

By the way, you seem to think 100fg is a lot here and will attract the best and brightest. It's really not. Programmers make 50 to 150$/hr, so working for 100fg isn't gonna attract anyone. It's like the poor people who pay a dentist with tamales. It's more of a thank you than payment. I'm the only loser who looks here multiple times a day. The other regulars check every few days or so.
Member
Posts: 649
Joined: May 28 2012
Gold: 14.00
Jan 11 2016 05:45am
You don't have any form in your html code.

This should work :

Code
<?php
if(isset($_POST["email"])) {
$ToEmail = 'my-email-goes-here@whatever.com';
$EmailSubject = 'Site contact form';
$mailheader = "From: ".$_POST["email"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$MESSAGE_BODY = "<div>Nom: ".$_POST["name"]."</div>";
$MESSAGE_BODY .= "<div>Courriel: ".$_POST["email"]."</div>";
$MESSAGE_BODY .= "<div>Téléphone: ".$_POST["telephone"]."</div>";
$MESSAGE_BODY .= "<div>Message: ".nl2br($_POST["message"])."</div>";
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");
}
?>

<form name="form1" method="post">
<div class="row">
<div class="input-field col s12">
<input id="icon_prefix" type="text" name="name" class="validate">
<label for="icon_prefix">Nom</label>
</div>
<div class="input-field col s12">
<input id="email" type="email" name="email" class="validate">
<label for="email" data-error="wrong" data-success="right">Courriel</label>
</div>
<div class="input-field col s12">
<input id="icon_telephone" name="telephone" type="tel" class="validate">
<label for="icon_telephone">Téléphone</label>
</div>
<div class="input-field col s12">
<textarea id="textarea1" name="message" class="materialize-textarea" length="550"></textarea>
<label for="textarea1">Message</label>
</div>
<div class="input-field col s12" align="center">
<input class="btn-large waves-effect waves-light main-background" type="submit" value ="Envoyez" name="action">
</div>
</div>
</form>
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll