Contact form email option box for php
#1
Posted 02 January 2012 - 07:32 PM
I have a PHP contact form and I was wandering if there is a way to select with a drop-down on who emails go to for example. Help desk or Management. You click on the drop-down and select on who to send it to.
#2
Posted 03 January 2012 - 07:59 AM
http://formtoemail.c...m_recipient.php
Also this:
http://apptools.com/...orms/forms3.php
#3
Posted 03 January 2012 - 02:55 PM
Vulcan, on 02 January 2012 - 07:32 PM, said:
I have a PHP contact form and I was wandering if there is a way to select with a drop-down on who emails go to for example. Help desk or Management. You click on the drop-down and select on who to send it to.
Yes i'd use a switch statement for this
switch($select_box){
case 'Help Desk':
$to = "helpdesk@site.com";
break;
case 'support':
$to = "support@site.com";
break;
case 'general':
$to = "general@site.com";
break;
}
this switches through the select boxes post variable to select the appropiate email needed
#4
Posted 17 January 2012 - 11:40 AM
webdesigner93, on 03 January 2012 - 02:55 PM, said:
switch($select_box){
case 'Help Desk':
$to = "helpdesk@site.com";
break;
case 'support':
$to = "support@site.com";
break;
case 'general':
$to = "general@site.com";
break;
}
this switches through the select boxes post variable to select the appropiate email needed
Sorry for the late reply. Thanks for that.
I'm having trouble adding it in to my form. How do you get the drop down.
Here is the form
Attached File(s)
-
contactform (2).zip (26.1K)
Number of downloads: 3
#5
Posted 17 January 2012 - 04:35 PM
Vulcan, on 17 January 2012 - 11:40 AM, said:
I'm having trouble adding it in to my form. How do you get the drop down.
Here is the form
http://www.tizag.com.../htmlselect.php
<select> <option value="mail@test1.com">Email 1</option> <option value="mail@test2.com">Email 2</option> <option value="mail@test3.com">Email 3</option> </select>
This post has been edited by Renaissance-Design: 20 January 2012 - 04:04 PM
Reason for edit: Please use the code button or tags to format your code.
#7
Posted 20 January 2012 - 03:57 PM
Quote
<select> <option value="mail@test1.com">Email 1</option> <option value="mail@test2.com">Email 2</option> <option value="mail@test3.com">Email 3</option> </select>
Be casreful using something like this as it could lead to your contact form being used to spam others best option would be something like:
<select id="selectbox"> <option value="support">Support</option> <option value="sales">Sales</option> <option value="general">General Enquiries</option> </select>
Then in your PHP use the switch statement to check and set the correct email address
switch($select_box)
{
case 'support':
$to = "support@site.com";
break;
case 'sales':
$to = "sales@site.com";
break;
case 'general':
$to = "general@site.com";
break;
}
This post has been edited by Renaissance-Design: 20 January 2012 - 04:04 PM
Reason for edit: Please use the code button or tags to format your code.
#8
Posted 20 January 2012 - 06:01 PM
#9
Posted 21 January 2012 - 11:21 PM
Try show what your code looks like.
This post has been edited by Samus: 21 January 2012 - 11:21 PM
Help
















