Reputation: 53
Because I am not familiar with PHP, I am using GoDaddy's PHP Form Mailer. I have created a form on my website. Here is an example of what it looks like:
<form action="_gdForm/webformmailer.asp" method="post" align="left">
<select>
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="submit" name="Submit">
When I receive the email, I get all of the information from the <input>
tags but nothing from the <select>
tags. Can anyone help me? Thank you.
Here is an example of the email that I will get:
FirstName: ~~~~
LastName: ~~~~
E-Mail: ~~~~
(I have a select tag after "E-Mail" that does not display)
Submit: Submit
I get no information whatsoever of my select tags.
Can anyone help? Thanks
Upvotes: 0
Views: 286
Reputation: 16303
You have to name them, that's all, like you did with your input elements.
<form action="/" method="post">
<input name="my-input">
<select name="my-select">
<option>1</option>
</select>
<input type="submit">
</form>
This is because PHP only knows about form data with a name, it can't process anything else. In your PHP script the values are accessed as follows:
<?php
$_POST["my-input"];
$_POST["my-select"];
?>
Upvotes: 1
Reputation: 31654
You need to add a name
attribute
<select name="myfield">
<option value="1">1</option>
<option value="2">2</option>
</select>
Your script probably parses all the fields by their name
Upvotes: 3