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?
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".
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.
<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>
If you want to make forms that work take a look here it's free
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.
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.
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
North America
Europe, Middle East and Africa
Asia Pacific