skippa Posted April 23, 2009 Share Posted April 23, 2009 ok. so ive got a php email form. but i want to change it, instead of me changing the email address in the code, i would like there to be several boxes with optional emails users on my site can send a prewritten email to. is there anyway i can do this? chris Quote Link to comment https://forums.phpfreaks.com/topic/155396-help-with-php-email-form/ Share on other sites More sharing options...
methodlessman Posted April 23, 2009 Share Posted April 23, 2009 <form action="whatev.html" method="POST" /> <select name="emails" id="emails"> <option>some.email1@some.url.com</option> <option>some.email2@some.url.com</option> <option>some.email3@some.url.com</option> <option>some.email4@some.url.com</option> </select> This way the user can select which person to email from a drop down menu. Quote Link to comment https://forums.phpfreaks.com/topic/155396-help-with-php-email-form/#findComment-817660 Share on other sites More sharing options...
skippa Posted April 23, 2009 Author Share Posted April 23, 2009 Hmm, but i still have to type in an option email right.? i want the user to be able to type in emails of there friends.. Quote Link to comment https://forums.phpfreaks.com/topic/155396-help-with-php-email-form/#findComment-817666 Share on other sites More sharing options...
mikesta707 Posted April 23, 2009 Share Posted April 23, 2009 I assume you want your users to be able to pick who they send an email to? then just make a normal input box... You may want to make some code that validates the input (IE makes sure its an actual email) Quote Link to comment https://forums.phpfreaks.com/topic/155396-help-with-php-email-form/#findComment-817668 Share on other sites More sharing options...
methodlessman Posted April 23, 2009 Share Posted April 23, 2009 I'm not sure exactly what you mean, but perhaps this would work. Create a text box and tell users to enter the email addresses in it seperated by a comma. Then run explode() (http://us3.php.net/explode). Use the comma as a delimiter and it will create an array containing all the email addresses the user entered. Quote Link to comment https://forums.phpfreaks.com/topic/155396-help-with-php-email-form/#findComment-817669 Share on other sites More sharing options...
skippa Posted April 23, 2009 Author Share Posted April 23, 2009 its difficult to explain. basicly Your name: (Name box here) email to send mail to: (email box here) email to send mail to: (email box here) email to send mail to: (email box here) email to send mail to: (email box here) Message: (message box here) Quote Link to comment https://forums.phpfreaks.com/topic/155396-help-with-php-email-form/#findComment-817677 Share on other sites More sharing options...
mikesta707 Posted April 23, 2009 Share Posted April 23, 2009 so you want multiple input text boxes where your user can input different email addresses to send the same message? well im assuming you can make the html page with the form. WHen you submit, and go to a php page do something like <?php $email1 = $_POST['Email1']; $email2 = $_POST['Email2']; //etc, make as many vars as you need //now put these variables into an array $email_array = array($email1, email2, etc...); //send the emails to each foreach($email_array as $email){ //your email script here. use $email variable as the to setting } ?> hope that helps Quote Link to comment https://forums.phpfreaks.com/topic/155396-help-with-php-email-form/#findComment-817701 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.