473,391 Members | 1,539 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,391 software developers and data experts.

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

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( "ka********@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: ka********@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>

Jun 30 '06 #1
7 2334
Syl

kandi111777 wrote:
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>

etc, etc,

Jun 30 '06 #2
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: ka***@kandiandkeith.com
Telephone: 315-292-6819
Fax: 3157353994
Subject:
Subject Other:
Contact Requested: on

Do you have another suggestion?

Syl wrote:
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,


Jun 30 '06 #3
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?

Jun 30 '06 #4
"Syl" <da**********@gmail.com> wrote in message
news:11**********************@y41g2000cwy.googlegr oups.com...

kandi111777 wrote:
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></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
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)
Jun 30 '06 #5
Message-ID: <11**********************@h44g2000cwa.googlegroups .com> from
kandi111777 contained the following:
<select name="selectitem" size="1">

and

$Subject = $_POST['selectitem'];
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">
Okay, now do you happen to know how to BCC a recipient?


mail( "ka********@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: ka********@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/
Jun 30 '06 #6
Kimmo Laine wrote:
"Syl" <da**********@gmail.comwrote in message
news:11**********************@y41g2000cwy.googlegr oups.com...
>kandi111777 wrote:
>>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
Jul 3 '06 #7
Jonathan N. Little:
Kimmo Laine wrote:
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

Jul 3 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Xerxes | last post by:
Hi, how can I pass the returned value from Javascript to PHP? I have: ------------------------------------------------------------------------ ------ if ( x>y) {
0
by: LU | last post by:
I have a datagrid for viewing and deleting. Under that I have a drop down with binded info and a button to add the select drop down item into database. 1User can view datagrid and delete info....
1
by: Dan | last post by:
This is one that has me stumped and I need an expert's input. Any ideas why the values from the second script-generated drop down list isn't recognized by the script to add time values to the...
4
by: Martyn Fewtrell | last post by:
I want to update a database record with a number of fields - doesn't sound to difficult at this stage! I have a system to select the correct record from the database and load the data into a...
2
by: Ren | last post by:
Hi all, I am a bit new to PHP and SQL so this may seem like a dumb question. I have already created a drop down list as part of a form which is automatically populated with values taken from a...
2
by: OceanBreeze | last post by:
I am using ASP.Net 2.0 and C# and new to this. I have programmatically added a zip code drop down into web form inside Page_Load method as: ZipDropDown.Items.Add("11111");...
2
by: rk330 | last post by:
Greetings I have a drop down list populated by my sql server database. The data on this ASP page consists of numbers that I use to calculate a grand total. This is performed by a javascript...
0
by: weiwei | last post by:
Hi here is my scenario, I create a drop down list in itemtemplate.(that drop down is created from db), after user click edit command, my ideal plan is have another drop down list in...
1
by: tsunethere | last post by:
hi .. I have 2 drop-down boxes. at first when web page will get load value this drop-down value will be"---" in this fashion. and 2nd drop-down will be disabled. unless and until user selects...
3
by: penny111 | last post by:
Hi there, For my application, i need to have 3 drop down lists 1. drop down list of folder names 2. drop down list of documents in the folder selected 3. drop down list of instances of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.