View Full Version : Email form please?
MrRSMan
05-08-2008, 06:35 PM
I need an email form where the user can specify the email address the message is sent to, who it's sent from and the email subject?
Is this possible? If so, how? Thank you.
boogyman
05-08-2008, 07:14 PM
all that but no message?
<form name="something" action="/somewhere.php" method="post">
<p>
<label>To:</label>
<input type="text" name="recipient" value="">
</p>
<p>
<label>From:</label>
<input type="text" name="from" value="">
</p>
<p>
<label>Subject:</label>
<input type="text" name="subject" value="">
</p>
</form>
MrRSMan
05-08-2008, 07:23 PM
Oh yeah, and a message field please?
boogyman
05-08-2008, 08:13 PM
<form name="something" action="/somewhere.php" method="post">
<p>
<label>To:</label>
<input type="text" name="recipient" value="">
</p>
<p>
<label>From:</label>
<input type="text" name="from" value="">
</p>
<p>
<label>Subject:</label>
<input type="text" name="subject" value="">
</p>
<p>
<label>Message:</label>
<textarea name="message" cols="20" rows="5"></textarea>
</p>
<p>
<input type="submit" name="submitBtn" value="Send Email">
</p>
</form>
change the cols value to the number of columns (width) you would like the box to appear on screen
change the rows value to the number of rows (height) you want the box to appear on screen
all that above is the html portion, that will only be what the user sees, you need another page, which in this form i have dubbed "somewhere.php" that will process the values and send the email. Check with your ISP (Website Host) to see if they support php... chances are they do, but some hosts don't allow it
if your host doesnt allow it... find out what type of mailing system they do support and let us know.
if you want to add any additional 1 line fields, just use the convention below
<p>
<label>NAME_OF_FIELD</label>
<input type="text" name="NAME_OF_FIELD" value="">
</p>
to add a multiple line text field like the message, use
<p>
<label>NAME_OF_FIELD</label>
<textarea name="NAME_OF_FIELD" cols="20" rows="5"></textarea>
</p>
I wrote a script a couple weeks ago that will do all of these things for you. It generates the html of the form, the javascript to validate it, and the php to send it. Assuming you have access to an editor it should be pretty easy for you. http://www.designforjoe.com/tester.php
Master_script_maker
05-08-2008, 09:02 PM
I wrote a script a couple weeks ago that will do all of these things for you. It generates the html of the form, the javascript to validate it, and the php to send it. Assuming you have access to an editor it should be pretty easy for you. http://www.designforjoe.com/tester.php
i see a couple errors:
<form action="mail_form.php" method="post"> onSubmit " var the_result="checkMandatory(); return the_result;"
...
<label for "email" ="Email: ">
also the javascript validation is good, but if javascript is disabled, they could send as many blank emails as they wanted. try php validation too. if you fix some of the more malignant errors, it could be very useful.:)
boogyman
05-09-2008, 02:03 AM
i see a couple errors:
<form action="mail_form.php" method="post"> onSubmit " var the_result="checkMandatory(); return the_result;"
...
<label for "email" ="Email: ">
also the javascript validation is good, but if javascript is disabled, they could send as many blank emails as they wanted. try php validation too. if you fix some of the more malignant errors, it could be very useful.:)
or better yet, use javascript to validate on the server side in real time (AJAX) that way you do not need to replicate your validation script in both php and javascript
Thanks for the advice on the form script - I will fix the noted bugs. I'll work up a server-side validation for it as well, although it will be a bit lenghtier. :p
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.