...

View Full Version : Php email form



adolph0034
08-30-2009, 04:57 PM
Okay simple question

What would the PHP CODE FOR THE FOLLOWING HTML:


<select name="choice">
<option selected="selected" label="Eventtype" value="Eventtype">
Select Event Type
</option>

<option label="Birthday Party" value="Birthday Party">Birthday Party
</option>
<option label="Block Party" value="Block Party">Block Party
</option>
<option label="Barmitfa" value="Barmitfa">Barmitfa
</option>
<option label="Corporate Event" value="Corporate Event">Corporate Event
</option>
<option label="Day Care Centers" value="Day Care Centers">Day Care Centers
</option>
<option label="Graduation Party" value="Graduation Party">Graduation Party
</option>
<option label="Private Event" value="Private Event">Private Event
</option>
<option label="Wedding Event" value="Wedding Event">Wedding Event
</option>
<option label="Other" value="Other">Other
</option>
</select>
<br >
<br />


<select name="choicetwo">
<option selected="selected" label="Number of Children" value="Number of Children">
Number of Children
</option>

<option label="12 and Under" value="12 AND Under">12 and Under
</option>
<option label="13 - 25" value="13-25">13 - 25
</option>
<option label="25 - 50" value="25 - 50">25 - 50
</option>
<option label="50 Plus" value="50 Plus">50 Plus
</option>
</select>
</fieldset>


RIGHT NOW MY PHP CODE (NOT WORKING HOWEVER)



$choice = $_POST['choice']
$choicetwo = $_POST['choicetwo'];


i guess my php form is wrong, i would appreciate any help.

thank you in advance for your time.

MikeLetscher
08-30-2009, 05:00 PM
You will need a form and a method of submitting the form in order for you to be able to access the selected values.

adolph0034
08-30-2009, 05:11 PM
I think you misunderstand my question, i understand i need submitt code

i want to know if the following snipet of code is wrong.



$choice = $_POST['choice']
$choicetwo = $_POST['choicetwo'];

Phil Jackson
08-30-2009, 05:15 PM
that is correct, also make sure your form method is set to post.

MikeLetscher
08-30-2009, 05:15 PM
I think you misunderstand my question, i understand i need submitt code

i want to know if the following snipet of code is wrong.



$choice = $_POST['choice']
$choicetwo = $_POST['choicetwo'];



It appears you have neglected to include PHP tags.. That would be important. But no, that code in and of itself looks fine. $choice will contain the value of the selected option for the choice select, $choicetwo will contain the value of the choicetwo select.

Is this PHP on the same page or a separate page? If the same, you need to check that the form was submitted before attempting to retrieve the values.


if (isset($_POST['choice']))
{
// Your PHP here.
}

Phil Jackson
08-30-2009, 05:20 PM
<?php
if(isset($_POST['submitForm']))
{
if (isset($_POST['choice']))
{
echo $_POST['choice']."<br />";
}
if (isset($_POST['choicetwo']))
{
echo $_POST['choicetwo']."<br />";
}
}
?>
<form method="post" action="index.php">
<fieldset>
<select name="choice">
<option selected="selected" label="Eventtype" value="Eventtype">Select Event Type</option>
<option label="Birthday Party" value="Birthday Party">Birthday Party</option>
<option label="Block Party" value="Block Party">Block Party</option>
<option label="Barmitfa" value="Barmitfa">Barmitfa</option>
<option label="Corporate Event" value="Corporate Event">Corporate Event</option>
<option label="Day Care Centers" value="Day Care Centers">Day Care Centers</option>
<option label="Graduation Party" value="Graduation Party">Graduation Party</option>
<option label="Private Event" value="Private Event">Private Event</option>
<option label="Wedding Event" value="Wedding Event">Wedding Event</option>
<option label="Other" value="Other">Other</option>
</select>
<br /><br />
<select name="choicetwo">
<option selected="selected" label="Number of Children" value="Number of Children">Number of Children</option>
<option label="12 and Under" value="12 AND Under">12 and Under</option>
<option label="13 - 25" value="13-25">13 - 25</option>
<option label="25 - 50" value="25 - 50">25 - 50</option>
<option label="50 Plus" value="50 Plus">50 Plus</option>
</select>
</fieldset>
<input type="submit" name="submitForm" value="submit" />
</form>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum