Reply
Advanced HTML - Forms
Old 05-30-2003, 06:37 PM Advanced HTML - Forms
WaHoOoO!'s Avatar
Mentally Unstable Tugboat Captain

Posts: 797
Name: Chad
Location: /usr/bin/perl
Ok, here's the deal: I have created a simple site response form on one page of this site I am creating. I have radio buttons depicting whether to send it to either myself or another person, based on the selection of the radio button. How can I put a line of coding into the form to send it to either e-mail address, based on which radio button is selected. The coding sample is as below:

Quote:
<form name="contact Form" action="mailto:contact@5sec.com" method="post" enctype="text/plain">

Name:
<input size=50 name="Name" class="input">

Email:
<input size=50 name="Email" class="input">

Send To:
<input type="radio" value="email-1" checked name="R1"> Steven
<input type="radio" value="email-2" name="R1">Chad

Comments: <textarea name=Description rows=4 cols=45 class="input"></textarea>

Thank You:
<input type=submit value="Submit" name="Submit" class="submit">
<input type=reset value=Reset name=Reset class="submit">

</form>
__________________
He's baaaaaaaack....
WaHoOoO! is offline
Reply With Quote
View Public Profile Visit WaHoOoO!'s homepage!
 
When You Register, These Ads Go Away!
Old 05-31-2003, 07:32 AM
david's Avatar
King Spam Talker

Posts: 1,314
Location: Glasgow, UK
Unfortunately that isn't possible using just HTML. To do something like that you will need to do server side scripting. Have you got access to PHP on your server?
__________________
Free Webmaster Help - Everything a webmaster needs - for free
Free-Webhosting.info - Free web hosts reviewed and rated
Web Hosting Hunt - Impartial hosting directory - Add your host today for FREE
david is offline
Reply With Quote
View Public Profile Visit david's homepage!
 
Old 05-31-2003, 01:34 PM
Average Talker

Posts: 29
Location: Israel
I agree with david. The better way is to use server side scripting.
But if you whant only to send not to collect some user info, Java Script can do that.
Here is the code:
<script language="JavaScript">
var browser=navigator.appName + " " + navigator.appVersion;
var message="";
if(browser.substring(0, 12)=="Netscape 4.0")
message="&body=";
var address="";
function setAddress(addr)
{
address=addr;
document.contactForm.value=address;
}
function doMail()
{
if(address!="") {
des = document.getElementById("des");
window.location="mailto:"+address+"?body="+des.val ue;
}
else {
alert("\nYou must select an address");
return false;
}
}
function resetForm()
{
address="";
}
</script>

Here is your form a little modified by me:

<form name="contactForm" method="post" enctype="text/plain">
Name:
<input size=50 name="Name" class="input">
Email:
<input size=50 name="Email" class="input">
Send To:
<input type="radio" onClick="setAddress('steven@mailserver.com')" name="R1">
Steven
<input type="radio" onClick="setAddress('chad@mailserver.com')" name="R1">
Chad Comments:
<textarea name="Description" rows=4 id="des" cols=45 class="input"></textarea>
Thank You:
<input type="submit" value="Submit" name="Submit" class="submit" onClick="doMail()">
<input type="reset" value="Reset" name="Reset" class="submit" onClick="resetForm()">
</form>

Good luck
ognen is offline
Reply With Quote
View Public Profile Visit ognen's homepage!
 
Old 06-04-2003, 09:42 AM
WaHoOoO!'s Avatar
Mentally Unstable Tugboat Captain

Posts: 797
Name: Chad
Location: /usr/bin/perl
Thanks...the server I am using doesn't get PHP installed until next year....oh well....thanks anyway. I might try the SSI trick instead.
__________________
He's baaaaaaaack....
WaHoOoO! is offline
Reply With Quote
View Public Profile Visit WaHoOoO!'s homepage!
 
Reply     « Reply to Advanced HTML - Forms
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14953 seconds with 12 queries