9 Replies Latest reply: Jul 4, 2012 11:50 AM by MurraySummers RSS

    Submit Button with CGI

    Isabel_Scota

      I have a form and I would like for my submit button to email me the contents once the person has completed the form.

       

      Here is my code:

       

      <body>

      <h3>Contact Us</h3>

      <form method="get" enctype="text/plain" name="Contact" id="Contact">

        <p>

          <label for="firstname2"><span class="star">*</span>First Name:</label>

          <input name="firstname" type="text" id="firstname2" maxlength="20" />

        </p>

        <p>

          <label for="lastname"><span class="star">*</span>Last Name:</label>

          <input name="lastname" type="text" id="lastname" maxlength="20" />

        </p>

        <p>

          <label for="email"><span class="star">*</span>Email Address:</label>

          <input type="text" name="email" id="email" />

        </p>

        <p>

          <label for="emailconfirmed"><span class="star">*</span>Confirm Email Address:</label>

          <input type="text" name="emailconfirmed" id="emailconfirmed" />

        </p>

        <p>

          <label for="subject"><span class="star">*</span>Subject:</label>

          <input name="subject" type="text" id="subject" maxlength="30" />

        </p>

        <p>

          <label for="message"><span class="star">*</span>Message:</label>

          <textarea name="message" id="message" cols="45" rows="5"></textarea>

        </p>

        <p>Submit

         <input type="submit" name="submit" id="submit" value="Submit" />

        </p>

      </form>

      </body>

       

       

      Here is the CGI code that my web host said to use: <input type='hidden' name='cgiemail-mailopt' value='sync'>

       

      Do I just plug it in where I have the text highlighted in my code?

        • 1. Re: Submit Button with CGI
          MurraySummers ACP/MVPs

          That would get you part of the way there.

           

          What is the name of the script file that is to process the form's data?  That should go in the action attribute of the form tag, e.g.,

           

          <form method="get" enctype="text/plain" name="Contact" id="Contact" action="YOUR_SCRIPT_FILENAME">

           

          And you probably also want the method to be "POST" not "GET".

          • 2. Re: Submit Button with CGI
            Isabel_Scota Community Member

            From what I can tell, the name of the script is "cgiemail" it's a MIT code (http://web.mit.edu/wwwdev/cgiemail/user.html). When I copy in the code, the "submit" button disappears.

            • 3. Re: Submit Button with CGI
              MurraySummers ACP/MVPs

              Let's see your page's code after you have copied in the code, please.

              • 4. Re: Submit Button with CGI
                Isabel_Scota Community Member

                <body>

                <h3>Contact Us</h3>

                <form method="get" enctype="text/plain" name="Contact" id="Contact" action="cgiemail">

                  <p>

                    <label for="firstname2"><span class="star">*</span>First Name:</label>

                    <input name="firstname" type="text" id="firstname2" maxlength="20" />

                  </p>

                  <p>

                    <label for="lastname"><span class="star">*</span>Last Name:</label>

                    <input name="lastname" type="text" id="lastname" maxlength="20" />

                  </p>

                  <p>

                    <label for="email"><span class="star">*</span>Email Address:</label>

                    <input type="text" name="email" id="email" />

                  </p>

                  <p>

                    <label for="emailconfirmed"><span class="star">*</span>Confirm Email Address:</label>

                    <input type="text" name="emailconfirmed" id="emailconfirmed" />

                  </p>

                  <p>

                    <label for="subject"><span class="star">*</span>Subject:</label>

                    <input name="subject" type="text" id="subject" maxlength="30" />

                  </p>

                  <p>

                    <label for="message"><span class="star">*</span>Message:</label>

                    <textarea name="message" id="message" cols="45" rows="5"></textarea>

                  </p>

                  <p>Submit

                     <input type='hidden' name='cgiemail-mailopt' value='sync' id="submit">

                  </p>

                </form>

                </body>

                • 5. Re: Submit Button with CGI
                  hjksdhuifa

                  If you want to make forms that work take a look here it's free

                   

                  PHP FormMail Generator

                   

                  All the forms on the web site that I built were made using PHP FormMail Generator and all work just fine.

                   

                  If you want to take a look at them in action you can test the form you have created before you download it and place it on your site.

                  • 6. Re: Submit Button with CGI
                    Isabel_Scota Community Member

                    Thanks for the suggestion. It is a lot easier than CGI but how do you get it into your DreamWeaver page? I tried cutting and pasting and it didn't work.

                     

                    http://www.hardgeared.com/contact_temp.html

                    • 7. Re: Submit Button with CGI
                      hjksdhuifa Community Member

                      Isabel

                       

                      After you have created and downloaded your form from  FormMail Generator you place the files on your site in the root directory.

                       

                      What I do is create a new folder and call it what ever,

                      For contact I have a contact folder, in side are the files downlaoded from FormMail Generator

                      Admin.php

                      email_traffics_log.php

                      form.lib.php

                      form.php

                      phpmailer.php

                       

                      then on my contact.html page I have the following to call the form for display on my page.

                       

                         <iframe frameborder="none" src="contact/form.php" allowTransparency="true" style="width:400px;height:500px; border:none" scrolling="auto"></iframe>

                       

                      Obviously you don't have to use iframe like I have.

                      • 8. Re: Submit Button with CGI
                        Isabel_Scota Community Member

                        I made a contact folder and copied the code that you provided but the form isn't coming up. Any suggestions?

                         

                        http://www.hardgeared.com/contact_temp.html

                        • 9. Re: Submit Button with CGI
                          MurraySummers ACP/MVPs

                          Are you able to run PHP on your server?  Have you uploaded the files suggested in the previous post?  Your iframe is looking for this file -

                           

                          contact/form.php

                           

                          but it doesn't seem to be finding it.