I need a little help. I am trying to get my PHP code (saved as a separate file named lulzy.php) to work but it just doesn't want to. What is it that I am doing wrong???
My goal is to get the users message directly into my e-mail inbox and right upon the user fills out my web form.
Here is the link to my JSFiddle: http://jsfiddle.net/8S82T/127/
And here is my PHP code:
<?php
$name= $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
mail( "mymail@gmail.com", "Feedback Form Results",
$message, "From: $email" );
header( 'Location: Index.html' );
?>
Everything is in the same folder on my desktop.
This is the message I receive when I try to fill the whole form and send a message:
Firefox can't find the file at /C:/Users/MS/Desktop/Slide Down Contact Me Form/lulzy.php
You need to have name attribute on each of your form input's
<input type="text" name ="fullName" placeholder="Please enter your full name here" required />
Same for email
and textarea
, and method='post'
instead of action='post'
Your php needs to be on your server not on your desktop.
You forgot to add name attributes:
<form action="lulzy.php" method="post">
<h6><img src="img/person.png" alt="" /> Name</h6>
<input name="name" type="text" placeholder="Please enter your full name here" required />
<h6><img src="img/email.png" alt="" /> E-mail</h6>
<input name="email" type="email" placeholder="Please enter your e-mail address" required/>
<h6><img src="img/message.png" alt="" /> Message</h6>
<textarea name="message" placeholder="Type your message..." required/></textarea>
<input type="submit" value="Submit">
</form>
You need method="POST"
instead of action="post"
your declaring action twice and not declaring your method
at all of how the form is posting to your PHP script
You also for your name attributes like the other answers state
I think none of the answers here contain the actual solution for this error message:
Firefox can't find the file at /C:/Users/MS/Desktop/Slide Down Contact Me Form/lulzy.php
This implies that
Furthermore, you forgot to add name
attributes to your form fields (as others have already mentioned here) and you declared the method attribute as the form's action by accident:
<form action="lulzy.php" action="post">
<!-- This should be right: -->
<form action="lulzy.php" method="post">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.