Forum Moderators: coopster

Message Too Old, No Replies

Dropdown with multiple e-mail adressess

HELP! I think i got the right script, but it doesn't do what i want

         

CR_Nick

1:51 pm on Jun 13, 2005 (gmt 0)

10+ Year Member



Hey everybody

I'm working on my 'contactpage' and i really want to have a form that looks like this page:

<snipped url per TOS [webmasterworld.com]>

Can anyone help me with that? Here is what I've got so far:

<html>
<head>
<title>Contact</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #FFFFFF;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<form action="../">
<select name="sendEmailTo">
<option value="mailto:bookings@example.com">Bookings (bookings@example.com)</option>
<option value="mailto:info@example.com">The Band (info@example.com)</option>
<option value="mailto:nick@example.com">Nick (nick@example.com)</option>
<option value="mailto:boj@example.com">Boj (boj@example.com)</option>
<option value="mailto:rob@example.com">Rob (rob@example.com)</option>
<option value="mailto:joep@example.com">Joep (joep@example.com)</option>
</select>
</p>
<p> <textarea name="textarea" cols="43" rows="5" wrap="physical">Enter Comments Here
</textarea>
</p>
<p>
<input
type="button"
value="Send"
onclick="location.href=this.form.sendEmailTo.options[sendEmailTo.selectedIndex].value">
</form>

</p>
</form>
</body>
</html>

it opens up the mail programm of the visitors when they press 'send' and I want it to be send immediately from the site to the chosen e-mail adress.. Can anyone help, please?

BTW, I know that my server has all the ASP, PHP etc. capability, but still i don't know how to do it..

[edited by: coopster at 2:55 pm (utc) on June 13, 2005]
[edit reason] generalized urls and emails per TOS [/edit]

mcibor

8:32 pm on Jun 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you know php? If yes, then have a look at the function mail at [pl.php.net...]

I you don't know php, then use a ready script from www.hotscripts.com

Best regards
Michal Cibor

PS. With ASP I don't know how to do that, but you may ask here on ASP forum

jatar_k

8:45 pm on Jun 13, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld CR_Nick,

well, first you would alter the form action to point to a script. In this case a php script. You would also need to remove the onClick event from the button and make it a regular submit button. In the targetted script you would need to process the posted values and then you could send the email using the function mcibor mentioned. You would also have to make some changes to the values in your select box.

You may want to look through these though

[hotscripts.com...]

Philosopher

9:08 pm on Jun 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also,

I would recommend NOT having the actual email addresses on the webpage. Create an ID for each of them that matches something on the backend.

That will keep email harvesters from gathering your email addresses for spam purposes.

jatar_k

10:01 pm on Jun 13, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



it will also allow the email to be hard coded into the script instead of sending an email to any address posted to the script.

CR_Nick

10:02 pm on Jun 13, 2005 (gmt 0)

10+ Year Member



Thanks alot guys, i'll try to put my teeth on the pages and info you gave me :) then i'll let you know here if it turn out good

jatar_k

10:06 pm on Jun 13, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could also try this thread for a better explanation if you wanted to roll your own.

Basics of Submitting and Emailing Forms with PHP [webmasterworld.com]

CR_Nick

3:45 pm on Jun 15, 2005 (gmt 0)

10+ Year Member



I got myself a new script and now I keep getting the error when I'm viewing the page:

"Parse error: parse error, unexpected T_ELSE in /home/music/public_html/test.php on line 272"

Can anyone help me with that?

[edited by: coopster at 4:38 pm (utc) on June 15, 2005]
[edit reason] snipped unnecessary code [/edit]

coopster

4:50 pm on Jun 15, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



That is a Parser Token [php.net] error. Looks like on or around line 272 of the /home/music/public_html/test.php script you have a control logic error, possible an IF/ELSE issue.