Firstly I would like to say I’m just a very newbie in php.
I have this simple php and as it is at the moment, when it sends the info it appears a horrible “Ok” message.
could you help me improving this php with:
-better code (is it ok? could it be better?)
-I would like to add a fancier answer (like in a box or something similar) in order to advice the user that his message has been sended.
Another thing is I am not sure this is working. I have xampp installed and locally it is not working. I also tried completing the form with all the files uploaded to the server and I´m still waiting for em….the miracle of the mail arriving to my inbox? =S Maybe I did something wrong?
<?php
if(isset($_POST["nombre"]) && isset($_POST["email"]) && isset($_POST["consulta"])){
$mymail = "myemail@gmail.com";
$subject = "Consulta";
$contenido = ":: Nombre: ". $_POST["nombre"]."\n";
$contenido .= ":: E-mail: ". $_POST["email"]."\n";
$contenido .= ":: Escribiò el siguiente mensaje: ". $_POST["consulta"]."\n";
$header = "From:".$_POST["email"]."\n";
mail($mymail, $subject, utf8_decode($contenido));*/
echo "&estatus=ok&";
}?>
Thanks in advance for your help!
regards,
In terms of understanding PHP and the mail function, this Link is a pretty good resource on it (as is the site for PHP/web coding in general.
You’re message to the user is on the last line where it says echo “&status=ok&”; Echo is the function that outputs text to the page. If you know html, you could output any html you would like e.g.
You’ll want to be careful with quotes though, as you need to Escape them along with some other special characters, e.g.
will look like
Anyways, that’s going off on a tangent. As for your xampp, you have to have your smtp settings configured. Check out this Post.
Let me know if your questions are answered 🙂