icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.
Old September 23rd, 2004, 9:49 PM   #1 (permalink)
Skittles
Super #1
 
DewKnight's Avatar
 
Joined in Aug 2004
Lives in a space ship
Hosted on dedi
6,725 posts
Gave thanks: 98
Thanked 190 times
email form possibility?

Ok well basically I want to have a form on my site whre one would use a dropdown list and pick either sales, technical, or general.... and depending on which one you selected from that list, it will email to a different email address the rest of the info that you submit through the form...

i didnt know if this was possible with maybe javascript... or php... or maybe if i would need a cgi script to do it... if i needed to use a cgi script i would want to protect the email addresses... and have it maybe send a variable or such to the script, and the script chooses which email to send it to... if somebody could let me know what i could do it in easiest.. and/or maybe give a little example of what i could do (like maybe if theres a script i can edit for myself somewhere....). well thanks in advance for any info...
__________________
Mountain Dew Knight
People should not be afraid of their governments. Governments should be afraid of their people.
DewKnight is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 23rd, 2004, 10:00 PM   #2 (permalink)
Web Hosting Super Ninj4
Super #1
 
miakeru's Avatar
 
Joined in Sep 2003
Lives in Fullerton, CA
1,581 posts
Gave thanks: 0
Thanked 2 times
Quote:
Originally Posted by DewKnight
Ok well basically I want to have a form on my site whre one would use a dropdown list and pick either sales, technical, or general.... and depending on which one you selected from that list, it will email to a different email address the rest of the info that you submit through the form...

i didnt know if this was possible with maybe javascript... or php... or maybe if i would need a cgi script to do it... if i needed to use a cgi script i would want to protect the email addresses... and have it maybe send a variable or such to the script, and the script chooses which email to send it to... if somebody could let me know what i could do it in easiest.. and/or maybe give a little example of what i could do (like maybe if theres a script i can edit for myself somewhere....). well thanks in advance for any info...
Sure, you could do this with PHP.

Create the form as normal, but have it pass the values to another PHP file or other section in your current one.

I found a great tutorial here: http://www.christian-web-masters.com...il-form-2.html

Then basically write an 'if' statement to mail to a different address if the selected option equals one you have set in the code.

Something like:

PHP Code:
if ( $pulldown == "technical" ) {
mail (etc...)";

miakeru is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 23rd, 2004, 10:03 PM   #3 (permalink)
surmunity freak
Comfy Contributor
 
Joined in Sep 2004
Lives in Baton Rouge, LA, North Amewica, USA, Earth
Hosted on D68; Serva; Pass15
143 posts
Gave thanks: 0
Thanked 0 times
I'm used to using php, and actually it's pretty easy with php. If you want to hide the email addresses completely, you can store them in a database, along with their named counterparts (e.g. Technical, Sales, ...), and just pass these in the form.

It would look like this
PHP Code:
<?php
$emails 
= array('Sales''Technical''Billing'); //can be expanded

echo "<select name=\"emailAddress\">";

for(
$i=0$i<sizeof($emails); $i++)
echo 
"<option value=\"$emails[$i]\" name=\"email\">$emails[$i]</option>";

echo 
"</select>";
?>
On your second page, the page the form loads after the submit button is pressed, you can view which one was selected with $_POST['email'];
__________________
Server: Pass15
twwright.net
NoE

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050405 Firefox/1.0 (Ubuntu package 1.0.2)

I run ubuntu hoary!
spartas is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 23rd, 2004, 10:06 PM   #4 (permalink)
Skittles
Super #1
 
DewKnight's Avatar
 
Joined in Aug 2004
Lives in a space ship
Hosted on dedi
6,725 posts
Gave thanks: 98
Thanked 190 times
ah i pretty much suck with php.... i could learn and probably figure it out... but if its hard i wont even bother hiding the email addresses...
__________________
Mountain Dew Knight
People should not be afraid of their governments. Governments should be afraid of their people.
DewKnight is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 23rd, 2004, 10:07 PM   #5 (permalink)
surmunity freak
Comfy Contributor
 
Joined in Sep 2004
Lives in Baton Rouge, LA, North Amewica, USA, Earth
Hosted on D68; Serva; Pass15
143 posts
Gave thanks: 0
Thanked 0 times
It's really not that difficult. The email addresses would be protected with either miakeru's or my response. We're just watching out for spammers that collect email addresses from web page source code.
__________________
Server: Pass15
twwright.net
NoE

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050405 Firefox/1.0 (Ubuntu package 1.0.2)

I run ubuntu hoary!
spartas is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 23rd, 2004, 10:16 PM   #6 (permalink)
Skittles
Super #1
 
DewKnight's Avatar
 
Joined in Aug 2004
Lives in a space ship
Hosted on dedi
6,725 posts
Gave thanks: 98
Thanked 190 times
ah i cant understand php wirth **** right now... i have some books on it but its confusing as hell to me... though i program in C++.........
__________________
Mountain Dew Knight
People should not be afraid of their governments. Governments should be afraid of their people.
DewKnight is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 23rd, 2004, 10:18 PM   #7 (permalink)
surmunity freak
Comfy Contributor
 
Joined in Sep 2004
Lives in Baton Rouge, LA, North Amewica, USA, Earth
Hosted on D68; Serva; Pass15
143 posts
Gave thanks: 0
Thanked 0 times
I've had much experience in C (not ++), as well as Java. I picked up PHP very easily, but the one thing that kept tripping me up was the dollar sign in front of the variables. I use dreamweaver on my dev machine (actually my only machine), which is convient for the syntax highlighting.
__________________
Server: Pass15
twwright.net
NoE

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050405 Firefox/1.0 (Ubuntu package 1.0.2)

I run ubuntu hoary!
spartas is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 23rd, 2004, 10:21 PM   #8 (permalink)
Web Hosting Super Ninj4
Super #1
 
miakeru's Avatar
 
Joined in Sep 2003
Lives in Fullerton, CA
1,581 posts
Gave thanks: 0
Thanked 2 times
Quote:
Originally Posted by spartas
I've had much experience in C. I picked up PHP very easily
Me too. It was quite an easy conversion.
miakeru is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 23rd, 2004, 10:22 PM   #9 (permalink)
Skittles
Super #1
 
DewKnight's Avatar
 
Joined in Aug 2004
Lives in a space ship
Hosted on dedi
6,725 posts
Gave thanks: 98
Thanked 190 times
ok i think im getting it now... em whats the html input type for a dropdown again?
__________________
Mountain Dew Knight
People should not be afraid of their governments. Governments should be afraid of their people.
DewKnight is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

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