I am trying to make my HTML form send all of its input via email to me. I can not get it to work, I was wondering if one of you guys would like to show me how to do the checkbox part.
to explain easier please vistit This Page
In this example I want the user to be able to enter their name then click on the fruit they would like to select. When they click submit an email is sent to aemail@somedomain.com in the email it shows:
Name -(their name)
Fruit- (The fruit they've selected)
Thats pretty much it. Thanks for all your help
Simple Email form
Moderator: General Moderators
- scorphus
- Forum Regular
- Posts: 589
- Joined: Fri May 09, 2003 11:53 pm
- Location: Belo Horizonte, Brazil
- Contact:
Try this fruits.php:
Note: using name="fruit[]" instead of name="fruit" 
Cheers,
Scorphus.
Code: Select all
<html>
<head>
</head>
<body>
<form ACTION="fruits.php" METHOD="post">
<input type=text NAME=NAME>
NAME
<br>
Fruit you want<br>
<input type=checkbox name="fruit[]" value="Apples">apple<br>
<input type=checkbox name="fruit[]" value="fruit">orange<br>
<input type=checkbox name="fruit[]" value="p">peach<br>
<input type=checkbox name="fruit[]" value="ddf">banana<br>
<input TYPE=submit Value=Send>
</form>
<pre>
<?php
print_r($_POST); // for test
?>
<pre>
</body>
</html>Cheers,
Scorphus.
- scorphus
- Forum Regular
- Posts: 589
- Joined: Fri May 09, 2003 11:53 pm
- Location: Belo Horizonte, Brazil
- Contact:
Some tips regarding HTML Standards:
Cheers,
Scorphus.
- Always use lower-case characters for tags and attributes:
Code: Select all
<form action="fruits.php" method="post"> - Always use double quotes around attributes' value:Note that attributes' value can be any case.
Code: Select all
<input type="text" name="NAME"> - Always close the tags:
Code: Select all
</form> </body> </html>
Cheers,
Scorphus.