i am new to php.... please send me a code tat will help me create a form n direct it to my home page and send the information of the form to my email
vardhani
0
Newbie Poster
Recommended Answers
Jump to PostI think that you are not new to php, in fact I think you don't want to learn PHP. If I'm wrong show us some effort, not just "ask code".
Jump to Postyour code seems fine...
if(mail($to, "Comment from your website", $message, "from: $email") { header("location: index.html"); // This will redirect your visitor when the email has been sent } else { echo("Message was not sent"); }
Jump to Postjust a bone, the opening tag, you have <? instead of <?php. I know this works on some configurations, but for maximum compatibility used <?php
Otherwise, like that other dude said it seems just fine. Also, for this code to work you need to have an smtp server configured on …
Jump to Postthe code i posted above does that...
$to = "your@email.com"; $email = $_POST["email"]; $subject = "Comment to your website"; $message = $_POST["message"]; $headers = "from: $email"; if(mail($to, $subject, $message, $headers)){ headers("location: index.html"); } else { echo("Your message was not sent"); }
All 13 Replies
MitkOK
61
Junior Poster
vardhani
0
Newbie Poster
webguru07
0
Newbie Poster
scru
909
Posting Virtuoso
Featured Poster
vardhani
0
Newbie Poster
vardhani
0
Newbie Poster
webguru07
0
Newbie Poster
buddylee17
216
Practically a Master Poster
scru
909
Posting Virtuoso
Featured Poster
buddylee17
216
Practically a Master Poster
webguru07
0
Newbie Poster
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
vardhani
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.