Loading ...
Sorry, an error occurred while loading the content.

Creating a form in html using php

Expand Messages
  • neilsbohr73
    I ve created an order form for stationery website I m designing. I want all the information entered on the form by the customer to be emailed to me. I know
    Message 1 of 7 , Feb 28, 2006
    • 0 Attachment
      I've created an order form for stationery website I'm designing. I
      want all the information entered on the form by the customer to be
      emailed to me. I know that I can do this using php. Can someone tell
      me what code to put in php file? Below is the code that I have for my
      form:

      <form action="processform.php" method="post" name="form1">

      I haven't actually created the processform.php file yet. I have
      searched high and low for this information and can't seem quite what
      pertains to my situation. Thanks in advance to anyone that can help.

      Jen H.
    • Marion Smith
      If all you want is the form to be emailed to you then you don t need the processform.php. I don t remember exactly but in the action property I think you just
      Message 2 of 7 , Mar 1, 2006
      • 0 Attachment
        If all you want is the form to be emailed to you then you don't need
        the processform.php. I don't remember exactly but in the action
        property I think you just put the email address there like an email
        like and the form will be sent to that address.

        (ex. mailto:name@...)

        I think that is all you need. If that doesn't work check the online
        help. I no that it is very simple to have a form mailed to you.

        Marion


        --- In JavaScript_Official@yahoogroups.com, "neilsbohr73"
        <neilsbohr73@...> wrote:
        >
        > I've created an order form for stationery website I'm designing. I
        > want all the information entered on the form by the customer to be
        > emailed to me. I know that I can do this using php. Can someone tell
        > me what code to put in php file? Below is the code that I have for my
        > form:
        >
        > <form action="processform.php" method="post" name="form1">
        >
        > I haven't actually created the processform.php file yet. I have
        > searched high and low for this information and can't seem quite what
        > pertains to my situation. Thanks in advance to anyone that can help.
        >
        > Jen H.
        >
      • Nick Jones
        Jen, Try this link out. And try posting this in a PHP list, this one is for Javascript only. http://us2.php.net/manual/en/function.mail.php Thanks -Nick ...
        Message 3 of 7 , Mar 1, 2006
        • 0 Attachment
          Jen,

          Try this link out. And try posting this in a PHP list,
          this one is for Javascript only.

          http://us2.php.net/manual/en/function.mail.php

          Thanks
          -Nick

          --- neilsbohr73 <neilsbohr73@...> wrote:

          > I've created an order form for stationery website
          > I'm designing. I
          > want all the information entered on the form by the
          > customer to be
          > emailed to me. I know that I can do this using php.
          > Can someone tell
          > me what code to put in php file? Below is the code
          > that I have for my
          > form:
          >
          > <form action="processform.php" method="post"
          > name="form1">
          >
          > I haven't actually created the processform.php file
          > yet. I have
          > searched high and low for this information and can't
          > seem quite what
          > pertains to my situation. Thanks in advance to
          > anyone that can help.
          >
          > Jen H.
          >
          >
          >
          >
          >
          >


          __________________________________________________
          Do You Yahoo!?
          Tired of spam? Yahoo! Mail has the best spam protection around
          http://mail.yahoo.com
        • MichaelPakay
          This is not a difficult task. Below is some sample code: Hope this gives you what you need. Michael Pakay pakaymc@gmail.com ___ Start Of Code for
          Message 4 of 7 , Mar 1, 2006
          • 0 Attachment
            This is not a difficult task. Below is some sample code: Hope this gives you what you need.

            Michael Pakay
            pakaymc@...

            ___ Start Of Code for processform.php ___
            <?php
            $today = Date("y/m/d");
            $email = $_POST[email];
            $name = $_POST[Name];

            $phone = $_POST[PhoneAC].$_POST[PhoneExch].$_POST[phone];
            // continue with fields


            $subject = "Request For Help";
            $message="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
            <html><head><Title>Request For Help</title>
            <body bgcolor=\"#ffffff\">

            <table width=\"800\" border=\"0\">
            <tr><td> <font size=\"3\"><b>Submitted on: </b></font>$today </td></tr>
            <tr><td> <font size=\"3\"><b>Email: </b></font>$email </td></tr>
            <tr><td> <font size=\"3\"><b>Name: </b></font>$name </td></tr>
            <tr><td> <font size=\"3\"><b>Address: </b></font>$address </td></tr>
            <tr><td> <font size=\"3\"><b>City: </b></font>$city </td></tr>
            <tr><td> <font size=\"3\"><b>State: </b></font>$state</td></tr>
            <tr><td> <font size=\"3\"><b>ZipCode: </b></font>$zipcode </td></tr>
            <tr><td> <font size=\"3\"><b>Phone: </b></font>$phone </td></tr>

            <tr><td> <font size=\"3\">Any additional wording you need. ...</td></tr>

            <!-- End Of Message -->
            <tr> <td><br ></td> </tr></table></body></html>";

            $headers=0;
            $headers="MIME-Version: 1.0\r\n";
            $headers.="Content-Type: text/html; charset=iso-8859-1\r\n";
            $headers.="Return-Path: YourEmail@...\r\n";
            $headers.="X-Priority: 3\r\n";
            $headers.="X-MSMail-Priority: Normal\r\n";
            $headers.="X-Mailer: php\r\n";
            $headers.="From: Me <YourEmail@...>\r\n";

            $To="AnyEmailAddress.com";

            mail($To,$subject,$message,$headers);

            unset($_POST);
            header("location: YourHomePage.php");
            )
            ?>
            ___ End Code ___
            ----- Original Message -----
            From: neilsbohr73
            To: JavaScript_Official@yahoogroups.com
            Sent: Tuesday, February 28, 2006 8:34 PM
            Subject: [JavaScript] Creating a form in html using php


            I've created an order form for stationery website I'm designing. I
            want all the information entered on the form by the customer to be
            emailed to me. I know that I can do this using php. Can someone tell
            me what code to put in php file? Below is the code that I have for my
            form:

            <form action="processform.php" method="post" name="form1">

            I haven't actually created the processform.php file yet. I have
            searched high and low for this information and can't seem quite what
            pertains to my situation. Thanks in advance to anyone that can help.

            Jen H.







            ------------------------------------------------------------------------------
            YAHOO! GROUPS LINKS

            a.. Visit your group "JavaScript_Official" on the web.

            b.. To unsubscribe from this group, send an email to:
            JavaScript_Official-unsubscribe@yahoogroups.com

            c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


            ------------------------------------------------------------------------------



            [Non-text portions of this message have been removed]
          • Jon Stephens
            1. The topic doesn t describe the task. You re not creating a form, you re generating an email based on form data. You can t produce a solution if you re not
            Message 5 of 7 , Mar 1, 2006
            • 0 Attachment
              1. The topic doesn't describe the task. You're not creating a form, you're
              generating an email based on form data. You can't produce a solution if you're
              not describing the problem or task accurately.

              2. HTML mail? Yecch! <font> tags? Yecch! Absolute font sizes? Yecch! Table width
              in px? Yecch!

              3. Why are you initialising the $headers variable twice?

              4. If you're the only person who's going to see this, then all you really need is:

              <?php

              $msg_body = "";

              for(each $_POST as $key->$value)
              $msg_body .= "$key: $value\n";

              // do the stuff with the headers and send...

              ?>


              > Date: Wed, 01 Mar 2006 14:10:18 -0500
              > From: MichaelPakay <pakaymc@...>
              > Subject: Re: Creating a form in html using php
              >
              > This is not a difficult task. Below is some sample code: Hope this gives you what you need.
              >
              > Michael Pakay
              > pakaymc@...
              >
              > ___ Start Of Code for processform.php ___
              > <?php
              > $today = Date("y/m/d");
              > $email = $_POST[email];
              > $name = $_POST[Name];
              >
              > $phone = $_POST[PhoneAC].$_POST[PhoneExch].$_POST[phone];
              > // continue with fields
              >
              >
              > $subject = "Request For Help";
              > $message="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
              > <html><head><Title>Request For Help</title>
              > <body bgcolor=\"#ffffff\">
              >
              > <table width=\"800\" border=\"0\">
              > <tr><td> <font size=\"3\"><b>Submitted on: </b></font>$today </td></tr>
              > <tr><td> <font size=\"3\"><b>Email: </b></font>$email </td></tr>
              > <tr><td> <font size=\"3\"><b>Name: </b></font>$name </td></tr>
              > <tr><td> <font size=\"3\"><b>Address: </b></font>$address </td></tr>
              > <tr><td> <font size=\"3\"><b>City: </b></font>$city </td></tr>
              > <tr><td> <font size=\"3\"><b>State: </b></font>$state</td></tr>
              > <tr><td> <font size=\"3\"><b>ZipCode: </b></font>$zipcode </td></tr>
              > <tr><td> <font size=\"3\"><b>Phone: </b></font>$phone </td></tr>
              >
              > <tr><td> <font size=\"3\">Any additional wording you need. ...</td></tr>
              >
              > <!-- End Of Message -->
              > <tr> <td><br ></td> </tr></table></body></html>";
              >
              > $headers=0;
              > $headers="MIME-Version: 1.0\r\n";
              > $headers.="Content-Type: text/html; charset=iso-8859-1\r\n";
              > $headers.="Return-Path: YourEmail@...\r\n";
              > $headers.="X-Priority: 3\r\n";
              > $headers.="X-MSMail-Priority: Normal\r\n";
              > $headers.="X-Mailer: php\r\n";
              > $headers.="From: Me <YourEmail@...>\r\n";
              >
              > $To="AnyEmailAddress.com";
              >
              > mail($To,$subject,$message,$headers);
              >
              > unset($_POST);
              > header("location: YourHomePage.php");
              > )
              > ?>



              --
              This message has not been scanned for viruses.

              Since I do not use a Microsoft operating
              system or software, and use only plaintext
              for email, there is little need for me to do so.
            • neilsbohr73
              I considered avoiding the PHP option by using the mailto:name@... option. However, does this allow me to add a redirect link that customers will be
              Message 6 of 7 , Mar 2, 2006
              • 0 Attachment
                I considered avoiding the PHP option by using the "mailto:name@..."
                option. However, does this allow me to add a redirect link that
                customers will be redirected after hitting "Submit"? Is so, great,
                and how do I do it?:)

                If not, then this is the sample form I'm working with:
                http://www.hawleyfocus.com/twinpapers/form2.htm

                And here's the code from process.php (I got this code from a form
                generator offered through my Fantastico). It also mentions "include
                ("global.inc.php")", but I don't know what to do with it, I just
                uploaded it, too. TIA:

                <?php
                include("global.inc.php");

                $errors=0;
                $error="The following errors occured while processing your form
                input.<ul>";

                pt_register('POST','Name');pt_register('POST','Address1');
                pt_register('POST','Address2');

                pt_register('POST','City');
                pt_register('POST','State');
                pt_register('POST','ZIP');
                p
                t_register('POST','Phone');
                pt_register('POST','EmailAddress');
                pt_register('POST','ShippingName');

                pt_register('POST','ShippingAddress1');
                pt_register('POST','ShippingAddress2');
                pt_register('POST','ShippingState');

                pt_register('POST','ShippingZIP');
                pt_register('POST','OrderShipping');
                pt_register('POST','RushOrder');

                pt_register('POST','Item1Number');

                pt_register('POST','Item1Name');
                pt_register('POST','FontNumber');
                pt_register('POST','FontColor');

                pt_register('POST','Quantity');
                pt_register('POST','Personalize');

                $Personalize=preg_replace("/(\015\012)|(\015)|
                (\012)/"," <br />", $Personalize);
                pt_register('POST','Layout');
                pt_register('POST','Text');
                pt_register('POST','ReturnAddress');

                pt_register('POST','ReturnAddress1');
                pt_register('POST','ReturnCity');
                pt_register('POST','ReturnState');

                pt_register('POST','ReturnZIP');
                pt_register('POST','FaxProof');

                pt_register('POST','AdditionalComments');
                $AdditionalComments=preg_replace("/(\015\012)|(\015)|
                (\012)/"," <br />",
                $AdditionalComments);
                if($Name=="" || $Address1=="" || $Address2=="" || $City=="" ||
                $State=="" || $ZIP=="" || $Phone=="" ||
                $EmailAddress=="" || $OrderShipping=="" || $Item1Number=="" ||
                $Item1Name=="" || $FontNumber=="" ||
                $FontColor=="" || $Quantity=="" || $Personalize=="" || $Layout==""
                || $Text=="" || $ReturnAddress=="" ||
                $FaxProof=="" || $RushOrder=="" )
                {
                $errors=1;
                $error.="<li>You did not enter one or more of the required fields.
                Please go back and try again.";
                }

                if($errors==1) echo $error;
                else{
                $where_form_is="http".
                ($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev
                (strstr(strrev($PHP_SELF),"/"));

                $message="Name: ".$Name."
                Address1: ".$Address1."
                Address2: ".$Address2."
                City: ".$City."
                State: ".$State."
                ZIP: ".$ZIP."

                Phone: ".$Phone."
                Email Address: ".$EmailAddress."
                Shipping Name: ".$ShippingName."

                Shipping Address1: ".$ShippingAddress1."
                Shipping Address2: ".$ShippingAddress2."

                Shipping State: ".$ShippingState."
                Shipping ZIP: ".$ShippingZIP."
                Order Shipping: ".$OrderShipping."
                Rush Order: ".$RushOrder.
                Item 1 Number: ".$Item1Number."
                Item 1 Name: ".$Item1Name."
                Font Number: ".$FontNumber."
                Font Color: ".$FontColor."

                Quantity: ".$Quantity."
                Personalize: ".$Personalize."
                Layout: ".$Layout."
                Text: ".$Text."

                Return Address on Envelopes: ".$ReturnAddress."
                Return Address: ".$ReturnAddress1."

                Return City: ".$ReturnCity."
                Return State: ".$ReturnState."
                Return Zip: ".$ReturnZip.
                "
                Fax Proof: ".$FaxProof."
                Additional Comments: ".$AdditionalComments."
                ";

                $message = stripslashes($message);

                mail("orders@...","Form Submitted at your
                website",$message,"From: phpFormGenerator");


                header("Refresh:
                0;url=http://www.hawleyfocus.com/twinpapers/orderconfirm.htm");
                ?><?php
                }
                ?>


                --- In JavaScript_Official@yahoogroups.com, "Marion Smith"
                <marionsmith_98@...> wrote:
                >
                > If all you want is the form to be emailed to you then you don't
                need
                > the processform.php. I don't remember exactly but in the action
                > property I think you just put the email address there like an email
                > like and the form will be sent to that address.
                >
                > (ex. mailto:name@...)
                >
                > I think that is all you need. If that doesn't work check the online
                > help. I no that it is very simple to have a form mailed to you.
                >
                > Marion
                >
                >
                > --- In JavaScript_Official@yahoogroups.com, "neilsbohr73"
                > <neilsbohr73@> wrote:
                > >
                > > I've created an order form for stationery website I'm designing.
                I
                > > want all the information entered on the form by the customer to
                be
                > > emailed to me. I know that I can do this using php. Can someone
                tell
                > > me what code to put in php file? Below is the code that I have
                for my
                > > form:
                > >
                > > <form action="processform.php" method="post" name="form1">
                > >
                > > I haven't actually created the processform.php file yet. I have
                > > searched high and low for this information and can't seem quite
                what
                > > pertains to my situation. Thanks in advance to anyone that can
                help.
                > >
                > > Jen H.
                > >
                >
              • Fernando (UK)
                Pessoal, como verifico se uma data tal esta ha mais de 3 meses? SELECT minha_dta FROM minha_tabela WHERE minha_data ??????????????????
                Message 7 of 7 , Mar 2, 2006
                • 0 Attachment
                  Pessoal, como verifico se uma data tal esta ha mais de 3 meses?

                  SELECT minha_dta
                  FROM minha_tabela
                  WHERE minha_data ??????????????????
                Your message has been successfully submitted and would be delivered to recipients shortly.