/    Sign up×
Community /Pin to ProfileBookmark

Form not working…

contact.php

[CODE]<form action=”contact2.php” method=”post”>
Name: <input type=”text” name=”name”><BR>
Email: <input type=”text” name=”email”><BR>
Comments:<BR>
<textarea name=”comments”></textarea><BR>
<input type=”submit” value=”Submit”>
</form>[/CODE]

contact2.php

[CODE]<?php
$name=$_POST[‘name’];
$email=$_POST[’email’];
$comments=$_POST[‘comments’];
$to=”[email protected]”;
$message=” Name: $name n Email: $email n Comments: $comments n IP: $REMOTE_ADDR”;
if(mail($to,”Comments From Your Site”,$message,”From: $emailn”)) {
echo “”;
} else {
echo “There was a problem sending the mail. Please check that you filled in the form correctly.”;
}
?>[/CODE]

Anyone any idea why when you fill in the form and submit and it goes to the next page the email doesn’t seem to reach my inbox?

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@SpectreReturnsSep 20.2005 — Can you prove that your emailing protocol is set up propperly?
Copy linkTweet thisAlerts:
@N00bletauthorSep 20.2005 — Erm.. What does that mean? I had a similar form on another site to another gmail account and that worked fine...
Copy linkTweet thisAlerts:
@SpectreReturnsSep 20.2005 — Try using mail() alone. Does it work?
Copy linkTweet thisAlerts:
@N00bletauthorSep 20.2005 — Nope, and it says 'Warning: mail() expects at least 3 parameters, 0 given in /home/nooblet/public_html/contact2.php on line 7

There was a problem sending the mail. Please check that you filled in the form correctly.' at the top.
Copy linkTweet thisAlerts:
@NogDogSep 20.2005 — Try getting rid of the "n" at the end of "From: $email". If you do have to have more than one line in the additional headers, the usual delimiter is "rn", not just "n".
Copy linkTweet thisAlerts:
@N00bletauthorSep 21.2005 — Tried, still doesn't work... >_>
Copy linkTweet thisAlerts:
@SpectreReturnsSep 21.2005 — Nope, and it says 'Warning: mail() expects at least 3 parameters, 0 given in /home/nooblet/public_html/contact2.php on line 7

There was a problem sending the mail. Please check that you filled in the form correctly.' at the top.[/QUOTE]


I meant, try using mail normally. If it sends the email, then your form is wrong. If it doesn't, your PHP configuration is wrong.
×

Success!

Help @N00blet spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...