Connecting Tech Pros Worldwide Help | Site Map

How to get value from drop down box to e-mail with php

  #1  
Old June 30th, 2006, 02:15 AM
kandi111777
Guest
 
Posts: n/a
I have a form that includes a drop down box. I can get all of the other
values to show up in an e-mail except for the drop down box values. Can
someone please help? -- I know the HTML isn't the greatest. The website
was originally created in FrontPage and the form broke. I'm just trying
to help out and fix it for a friend.

sendmail.php
<?
$Name = $_REQUEST['name'] ;
$Comments = $_REQUEST['comments'] ;
$Email = $_REQUEST['email'] ;
$Telephone = $_REQUEST['telephone'];
$Fax = $_REQUEST['fax'];
$Subject = $_REQUEST['subject'];
$SubjectOther = $_REQUEST['subjectother'];
$ContactRequested = $_REQUEST['contactrequested'];

mail( "kandihumpf@site-seeker.com", "RCI Waterjets Contact Us Form",
"Name: $Name \n\nComments: $Comments \n\nEmail: $Email
\n\nTelephone: $Telephone \n\nFax: $Fax \n\nSubject: $Subject
\n\nSubject Other: $SubjectOther \n\nContact Requested:
$ContactRequested", "From: kandihumpf@site-seeker.com" );
header( "Location: http://www.rciwaterjets.com/Thanks.htm" );
?>



ContactUsNEW.htm
<form method="post" action="sendmail.php">
<p align="center">
&nbsp;<textarea name="comments" rows="8" cols="66">Please Enter your
details here</textarea></p>
<dl>
<dd>
<table width="450">
<tr>
<td width="84" align="right"><font size="2">Name</font></td>
<td width="286" align="center">
<p align="center">
&nbsp;<input name="name" type="text" size="35" maxlength="256"/></td>
<td width="66">Required</td>
</tr>
<tr>
<td width="84" align="right"><font size="2">E-mail</font></td>
<td width="286" align="center">
<p align="center">
<input name="email" type="text" size="35" maxlength="256"/></td>
<td width="66">Optional</td>
</tr>
<tr>
<td width="84" align="right"><font size="2">Tel</font></td>
<td width="286" align="center">
<p align="center">
&nbsp;<input name="telephone" type="text" size="35"
maxlength="256"/></td>
<td width="66">Optional</td>
</tr>
<tr>
<td width="84" align="right"><font size="2">Fax</font></td>
<td width="286" align="center">
<p align="center">
<input name="fax" type="text" size="35" maxlength="256"/></td>
<td width="66">Optional</td>
</tr>
</table>
</dd>
</dl>
<dl>
<dd>
<table width="448">
<tr>
<td width="88" align="right"><select name="Subject" size="1">
<option selected>Web Site</option>
<option>Company</option>
<option>Products</option>
<option>Store</option>
<option>Employee</option>
<option>(Other)</option>
</select> </td>
<td width="38">
<p align="center"><font size="2">Other:</font></td>
<td width="252">
<input name="subjectother" type="text" size="35"
maxlength="256"/></td>
<td width="52">&nbsp;</td>
</tr>
<tr>
<td width="88" align="right">&nbsp;</td>
<td width="351" colspan="3">&nbsp;</td>
</tr>
<tr>
<td width="88" align="right"><input name="contactrequested"
type="checkbox"></td>
<td width="351" colspan="3">
<p align="center">Please contact me as soon as possible regarding
this matter.</td>
</tr>
<tr>
<td width="442" align="right" colspan="4">
<p align="center"><input type="submit"/><input type="reset"
value="Reset" name="B2"></td>
</tr>
</table>
</dd>
</dl>
<p
align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;
</p>
</form>

  #2  
Old June 30th, 2006, 02:35 AM
Syl
Guest
 
Posts: n/a

re: How to get value from drop down box to e-mail with php



kandi111777 wrote:[color=blue]
> I have a form that includes a drop down box. I can get all of the other
> values to show up in an e-mail except for the drop down box values. Can
> someone please help? -- I know the HTML isn't the greatest. The website
> was originally created in FrontPage and the form broke. I'm just trying
> to help out and fix it for a friend.
>
> sendmail.php
> $Subject = $_REQUEST['subject'];
> <td width="88" align="right"><select name="Subject" size="1">
> <option selected>Web Site</option>
> <option>Company</option>
> <option>Products</option>
> <option>Store</option>
> <option>Employee</option>
> <option>(Other)</option>
> </select> </td>[/color]


You're missing a value in the option of the drop down

Change all the options like this --> <option>Company</option>
to this --> <option value="company">Company</option>
to this --> <option value="employee">Employee</option>

etc, etc,

  #3  
Old June 30th, 2006, 04:15 AM
kandi111777
Guest
 
Posts: n/a

re: How to get value from drop down box to e-mail with php


I made the changes so now it looks like this:

<td width="88" align="right"><select name="Subject" size="1">
<option selected value="website">Web Site</option>
<option value="company">Company</option>
<option value="products">Products</option>
<option value="store">Store</option>
<option value="employee">Employee</option>
<option value="other">Other</option>
</select> </td>

But it still isn't working. My e-mail looks like this:

Name: Kandi M. Humpf
Comments: test
Email: kandi@kandiandkeith.com
Telephone: 315-292-6819
Fax: 3157353994
Subject:
Subject Other:
Contact Requested: on

Do you have another suggestion?

Syl wrote:[color=blue]
> You're missing a value in the option of the drop down
>
> Change all the options like this --> <option>Company</option>
> to this --> <option value="company">Company</option>
> to this --> <option value="employee">Employee</option>
>
> etc, etc,[/color]

  #4  
Old June 30th, 2006, 04:35 AM
kandi111777
Guest
 
Posts: n/a

re: How to get value from drop down box to e-mail with php


Thanks! It works now...I had to change:

<select name="selectitem" size="1">

and

$Subject = $_POST['selectitem'];

Okay, now do you happen to know how to BCC a recipient?

  #5  
Old June 30th, 2006, 06:55 AM
Kimmo Laine
Guest
 
Posts: n/a

re: How to get value from drop down box to e-mail with php


"Syl" <david.hunter@gmail.com> wrote in message
news:1151631503.326607.307760@y41g2000cwy.googlegr oups.com...[color=blue]
>
> kandi111777 wrote:[color=green]
>> I have a form that includes a drop down box. I can get all of the other
>> values to show up in an e-mail except for the drop down box values. Can
>> someone please help? -- I know the HTML isn't the greatest. The website
>> was originally created in FrontPage and the form broke. I'm just trying
>> to help out and fix it for a friend.
>>
>> sendmail.php
>> $Subject = $_REQUEST['subject'];
>> <td width="88" align="right"><select name="Subject" size="1">
>> <option selected>Web Site</option>
>> <option>Company</option>
>> <option>Products</option>
>> <option>Store</option>
>> <option>Employee</option>
>> <option>(Other)</option>
>> </select> </td>[/color]
>
>
> You're missing a value in the option of the drop down
>
> Change all the options like this --> <option>Company</option>
> to this --> <option value="company">Company</option>
> to this --> <option value="employee">Employee</option>
>[/color]


That's not an issue, if value is not given, then anything that's inside the
<option></option> will be used instead. In this case for example
<option>Company</option> Company will be used since it lacks value.

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)


  #6  
Old June 30th, 2006, 07:25 AM
Geoff Berrow
Guest
 
Posts: n/a

re: How to get value from drop down box to e-mail with php


Message-ID: <1151638485.258930.165200@h44g2000cwa.googlegroups .com> from
kandi111777 contained the following:
[color=blue]
><select name="selectitem" size="1">
>
>and
>
>$Subject = $_POST['selectitem'];[/color]

All you really had to do was make sure they were the same case. You had
$Subject = $_REQUEST['subject'];
and
<select name="Subject" size="1">[color=blue]
>
>Okay, now do you happen to know how to BCC a recipient?[/color]

mail( "kandihumpf@site-seeker.com", "RCI Waterjets Contact Us Form",
"Name: $Name \n\nComments: $Comments \n\nEmail: $Email
\n\nTelephone: $Telephone \n\nFax: $Fax \n\nSubject: $Subject
\n\nSubject Other: $SubjectOther \n\nContact Requested:
$ContactRequested", "From: kandihumpf@site-seeker.com
\nBcc:me@example.com" );

Doesn't work on some setups though. Check with your service provider.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
  #7  
Old July 3rd, 2006, 05:15 PM
Jonathan N. Little
Guest
 
Posts: n/a

re: How to get value from drop down box to e-mail with php


Kimmo Laine wrote:
Quote:
"Syl" <david.hunter@gmail.comwrote in message
news:1151631503.326607.307760@y41g2000cwy.googlegr oups.com...
Quote:
>kandi111777 wrote:
Quote:
>>I have a form that includes a drop down box. I can get all of the other
>>values to show up in an e-mail except for the drop down box values. Can
>>someone please help? -- I know the HTML isn't the greatest. The website
>>was originally created in FrontPage and the form broke. I'm just trying
>>to help out and fix it for a friend.
>>>
>>sendmail.php
>> $Subject = $_REQUEST['subject'];
>> <td width="88" align="right"><select name="Subject" size="1">
>> <option selected>Web Site</option>
>> <option>Company</option>
>><option>Products</option>
>> <option>Store</option>
>> <option>Employee</option>
>> <option>(Other)</option>
>> </select</td>
>>
>You're missing a value in the option of the drop down
>>
>Change all the options like this --<option>Company</option>
>to this --<option value="company">Company</option>
>to this --<option value="employee">Employee</option>
>>
>
>
That's not an issue, if value is not given, then anything that's inside the
<option></optionwill be used instead. In this case for example
<option>Company</optionCompany will be used since it lacks value.
>
Browser dependent, MS IE doesn't set the value by default. It really
becomes noticeable in JavaScript if you test for someSelectElement.value
will fail in IE if you do not explicitly set the value attributes on the
OPTION elements...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
  #8  
Old July 3rd, 2006, 07:15 PM
John Dunlop
Guest
 
Posts: n/a

re: How to get value from drop down box to e-mail with php


Jonathan N. Little:
Quote:
Kimmo Laine wrote:
>
Quote:
That's not an issue, if value is not given, then anything that's inside the
<option></optionwill be used instead. In this case for example
<option>Company</optionCompany will be used since it lacks value.
>
Browser dependent, MS IE doesn't set the value by default. It really
becomes noticeable in JavaScript if you test for someSelectElement.value
will fail in IE if you do not explicitly set the value attributes on the
OPTION elements...
not disputing that, but I'd point out that the spec is quite clear
when it says, as Kimmo said, that in the absence of a value attribute,
the value is set to the element's content.

--
Jock

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
fasttemplate with drop down box boyindie86 answers 1 August 1st, 2008 12:37 PM
getting selected item of drop down box gubbachchi answers 1 March 18th, 2008 02:20 PM
Drop down menus and searching the DB Chrisjc answers 23 November 13th, 2006 11:42 PM
Dependant Drop Down Box JimS answers 2 July 20th, 2006 02:22 PM
passing retirned value from Javascript to PHP Xerxes answers 2 July 17th, 2005 05:10 AM