Web Design Forum: Contact form email option box for php - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Contact form email option box for php Rate Topic: -----

#1 User is online   Vulcan 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 466
  • Joined: 18-December 10
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:I'm Learning

Posted 02 January 2012 - 07:32 PM

Hello,

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.
0

#2 User is offline   nfc212 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 257
  • Joined: 29-August 11
  • Reputation: 27
  • Gender:Male
  • Location:Cardiff, UK
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 03 January 2012 - 07:59 AM

Take a look at this:

http://formtoemail.c...m_recipient.php

Also this:

http://apptools.com/...orms/forms3.php
0

#3 User is offline   webdesigner93 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,976
  • Joined: 22-September 09
  • Reputation: 222
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 03 January 2012 - 02:55 PM

View PostVulcan, on 02 January 2012 - 07:32 PM, said:

Hello,

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
0

#4 User is online   Vulcan 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 466
  • Joined: 18-December 10
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:I'm Learning

Posted 17 January 2012 - 11:40 AM

View Postwebdesigner93, on 03 January 2012 - 02:55 PM, said:

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



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)


0

#5 User is offline   Samus 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 367
  • Joined: 05-August 11
  • Reputation: 27
  • Gender:Male
  • Location:Hackney, London, UK
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 17 January 2012 - 04:35 PM

View PostVulcan, on 17 January 2012 - 11:40 AM, said:

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

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.

0

#6 User is online   Vulcan 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 466
  • Joined: 18-December 10
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:I'm Learning

Posted 17 January 2012 - 07:20 PM

Would that work with the form?? Because it php.
0

#7 User is offline   php3ch0 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 24-August 11
  • Reputation: 0

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.

0

#8 User is online   Vulcan 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 466
  • Joined: 18-December 10
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:I'm Learning

Posted 20 January 2012 - 06:01 PM

It's not working when i add the email to where its ment to be. I have added the HTML
0

#9 User is offline   Samus 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 367
  • Joined: 05-August 11
  • Reputation: 27
  • Gender:Male
  • Location:Hackney, London, UK
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 21 January 2012 - 11:21 PM

Replying "it's not working" doesn't tell us what is not working.

Try show what your code looks like.

This post has been edited by Samus: 21 January 2012 - 11:21 PM

0

#10 User is online   Vulcan 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 466
  • Joined: 18-December 10
  • Reputation: 1
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:I'm Learning

Posted 24 January 2012 - 11:40 AM

View PostSamus, on 21 January 2012 - 11:21 PM, said:

Replying "it's not working" doesn't tell us what is not working.

Try show what your code looks like.



I gave a folder of the form I have and i replaced the php where the email is hand the HTML. And lots of errors kept on coming up. Like on line 36.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users