I have a block of code that takes a form, posts it to the same page with a thank you message and then proceeds to email it to my account.
As of right now, it displays like this in the email end:
hello world., Name: Hello World, , Email: HelloWorld@fake.com
Which means it goes message, name, then email.
How can I make it so it displays similar to something like this in the email..
Name: Hello World
Email: HelloWorld@fake.com
Message: hello world...
Here is the code I am using:
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$subject = $_REQUEST["My Portfolio Website"] ;
$message = $_REQUEST['message'].", Name: ".$name.", Email: ".$email;
mail("MyEmail@gmail.com", $subject, $message, "From:" . $email);
echo "<h1>Thank you for contacting me. I will get back to you ASAP!</h1>";
}else{
//if "email" is not filled out, display the form
echo "<form method='post' action='index.php'>
<input type='text' input name='name' id='name' class='contacttext' placeholder='Your Name' required>
<input type='text' input name='email' id='email' class='contacttext' placeholder='Your Email Address' required>
<textarea name='message' id='message' class='contacttext' placeholder='Your Message' cols='55' rows='5' required></textarea>
<input type='submit' id='submit' class='submitcontacttext' value='Send'>
</form>";
}
?>
Also, currently the subject is not setting itself, what would be the cause of this?