I'm trying to build an Order Form for my website. That people type their info into and then submit it to me and it gets emailed to me. I've created the form and now i just can't figure out how to get it to email it to me. I've tried the mailto: and it opens up the mail thing on my mac everytime. anyone know how to fix this problem?
  • getclassy

    alright. i also tried one php thing but it just redirect the page to the home page for some reason. i think the extension was gdform.php

    i'm i on the write track?
  • getclassy

    hah thanks and sorry about those typos i wasnt thinking as i was typing.
  • DCBeatty

    Yeah you need to use php. Make sure the form's method is set to post and then the action is set to the correct php file.

    In that php file, you should have something like the following code (plus any validation code you need, I don't feel like putting all that in). Keep in mind this is just basic code. Switch out the stuff I put with whatever you want it to say, but now you have a basic template to work from. Hope this helps!

    $to = 'you@yoursite.com';
    $subject = 'some subject';
    $message = 'Here's the order info'.$_POST['order'];
    $headers = 'From: ' . $_POST['email'] . "\r
    " . 'Reply-To: ' . $_POST['email'];

    mail($to, $subject, $message, $headers);
    ?>
  • getclassy

    Thanks, I'll give it a shot and are the ? supposed to be replaced with something or is that part of the code?
  • getclassy

    I got it to send me an email! awesome. The only problem is that it didn't contain any of the form info only "Here's the order info."
  • William Henry

    Google it. Theres a million websites that will show you how to do this in 5 minutes.
  • treycook

    William Henry said: Google it. Theres a million websites that will show you how to do this in 5 minutes.
  • DCBeatty

    maxD said:
    William Henry said: Google it. Theres a million websites that will show you how to do this in 5 minutes.

    javascripts doing exactly what you're after can be downloaded for free all over the place. Google.

    Technically that's incorrect. JavaScript can't send emails. Unless you mean using AJAX to submit the form, but that's still more PHP than JavaScript.
    getclassy said: I got it to send me an email! awesome. The only problem is that it didn't contain any of the form info only "Here's the order info."

    Yeah you have to change the $_POST['order'] to $_POST['whatever the name of your order textbox is']
  • treycook

    maxD said:

    javascripts doing exactly what you're after can be downloaded for free all over the place. Google.

    Javascript is client-side, PHP is server-side. In order for a web form to send an email it must be processed through your server. Your server then sends the email. Javascript can help you build a fancy form but won't actually work any of the magic.
  • getclassy

    Haha, I did end up googling it and found out how to do it in .php

Advertise with us

Advertise with us


Sign Up

Forgot Your Password?