4 Replies Latest reply on Sep 7, 2008 3:03 PM by DwFAQ

    Sending Form Data to an E-mail address using PHP.

    azzgo21
      Hi,
      Can you please proof this code, to see if it will be able to send data to an e-mail address please.

      Thanks
        • 1. Sending Form Data to an E-mail address using PHP.
          DwFAQ Level 4
          Sorry there's lot of errors in your code. Check it out this should help.

          http://JasperThayer.com/forms


          • 2. Re: Sending Form Data to an E-mail address using PHP.
            azzgo21 Level 1
            OK so i fixed all the PHP errors, I think, it still isn't working though.

            Do I have to upload the page to the server for the form data to be sent?

            Here is the code now according to the reference you gave me

            <?php
            $to="platinumprostudies@msn.com";
            $subject="subject"
            $message="Text Field Entry:".$E-Mail;
            $message="Text Field Entry:".$ContactTextArea;
            $message=\nCheckbox Entry:".$1;
            $message=\nCheckbox Entry:".$2;
            $message=\nCheckbox Entry:".$3;
            $message=\nCheckbox Entry:".$4;
            $message=\nCheckbox Entry:".$5;
            mail($to, $subject, $message);
            ?>

            Is this correct? $to=e-mail address, $subject=the text field "subject
            $message= the text field e-mail and contact text area, and the numbers that follow the checkbox code, are the names of the checkboxes.

            Please point out anything incorrect in the PHP code, I'm almost 100% that the HTML form code is correct, as you can see PHP is not my language :) Thanks
            • 3. Re: Sending Form Data to an E-mail address using PHP.
              azzgo21 Level 1
              I visited your website, as was about to contact Jasper Thayer from his website, then I realized that you were Jasper Thayer :D
              • 4. Re: Sending Form Data to an E-mail address using PHP.
                DwFAQ Level 4
                Your form code is incorrect. There are some areas that are not formatted properly and some areas that are just written wrong! For instance your checkbox input form fields do not have a value so when someone checks it and sends you the form you would not receive any information even if your php code was correct. You need the action of your form to be sent to your_php_script.php which should include the php script along with a confirmation message that the form was sent. The php code you have is not properly concatenated please look at the code I've provided and retry. You need to be specific about quotations, periods, etc. the name on your form fields has to be the same as the $variable in php code. You have areas all over your form code that do not belong for instance this.

                <div align="center"></div>
                <span id="sprycheckbox1">
                <label> </label>
                </span>

                and this.

                <div align="center"></div>
                <div align="center"></div>
                <div align="center"></div>

                and this


                <h1> </h1>


                My recommendation is to look at the code I've provided, study it, grasp the concept. Best of luck to you.

                Jasper