The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Problem With Forms
newwebdesigner
post Aug 15 2014, 02:58 PM
Post #1


Newbie
*

Group: Members
Posts: 12
Joined: 15-August 14
Member No.: 21,405



Hi guys,
So I have been struggling with HTML forms again, and I don't know what is wrong. I don't really know much about PHP but I am trying to learn. I have been having this problem for a few months now, not with this form, but handling forms in general. Thanks in advance for your responces. I took my email out of the following code for safety reasons:
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Basic Form</title>
</head>
<Body>
<form method="post" name="Basicform" action="handle.php">
Enter Name:<input type="text" name="name">
Enter Email:<input type="Text" name="email">
Enter Message:<textarea name="message"></textarea>
<input type="submit" value="Send Form"
</body>
</html>

Here is handle.php:
<?php
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$message = $_POST['message'];


$email_from = 'emailwouldgohere';

$email_subject = "New Form submission";

$email_body = "You have received a new message from the user $name.\n".
"Here is the message:\n $message".


$to = "Emailwouldgohere";

$headers = "From: $email_from \r\n";

$headers .= "Reply-To: $visitor_email \r\n";

mail($to,$email_subject,$email_body,$headers);

?>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Aug 15 2014, 04:58 PM
Post #2


Programming Fanatic
********

Group: Members
Posts: 1,981
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



You did not say what the problem is. I can see a couple of small errors so lets try that first:
CODE
<input type="submit" value="Send Form"
is missing the closing > character.
Also, $email_body is missing the ending ; character and I'm not sure why you have an ending . there (the first period is to join the 2 sentences, I assume).
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Aug 15 2014, 05:20 PM
Post #3


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



Also the </form> end tag is missing.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Aug 15 2014, 07:26 PM
Post #4


Programming Fanatic
********

Group: Members
Posts: 1,981
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



QUOTE(Christian J @ Aug 15 2014, 05:20 PM) *

Also the </form> end tag is missing.
I missed that one. sad.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
newwebdesigner
post Aug 16 2014, 10:59 AM
Post #5


Newbie
*

Group: Members
Posts: 12
Joined: 15-August 14
Member No.: 21,405



SO you guys think if I fix those small things it will work perfectly?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Aug 16 2014, 12:12 PM
Post #6


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



There could be other problems too, but start with fixing the above.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
newwebdesigner
post Aug 17 2014, 11:49 AM
Post #7


Newbie
*

Group: Members
Posts: 12
Joined: 15-August 14
Member No.: 21,405



I fixed those things, but it is still asking me if I want to save handle.php(the script)
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Aug 17 2014, 12:42 PM
Post #8


Programming Fanatic
********

Group: Members
Posts: 1,981
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



Are you sure you have PHP installed? I have seen the save action before, on computers without PHP.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
newwebdesigner
post Aug 18 2014, 03:07 PM
Post #9


Newbie
*

Group: Members
Posts: 12
Joined: 15-August 14
Member No.: 21,405



Ah you are right. Like I said- I am new to php, and for some reason I did not come across that I needed to install something. I will install apache, and PHP and see if it works, thanks for all the help guys . biggrin.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
newwebdesigner
post Aug 28 2014, 03:32 PM
Post #10


Newbie
*

Group: Members
Posts: 12
Joined: 15-August 14
Member No.: 21,405



So I decided on webmatrix 3, and I dunno if it is a glitch or something but when I fill out the form and push enter I get a 404 error.That is normal because I do not have a redirect set up, but when I go check the email I am using this for, it doesn't show up, I have checked spam folder and everything, and suggestions?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Aug 28 2014, 04:05 PM
Post #11


Programming Fanatic
********

Group: Members
Posts: 1,981
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



Without seeing any code all I can do is guess. Post some code.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 05:40 AM