Simple Email form

Looking for volunteers to join your project? Need help with a script but can't afford to pay? Want to offer your services as a volunteer to build up your portfolio? This is the place for you...

Moderator: General Moderators

Post Reply
Doughboy5170
Forum Newbie
Posts: 2
Joined: Tue Nov 11, 2003 8:01 pm

Simple Email form

Post by Doughboy5170 »

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
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

Try this fruits.php:

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>
Note: using name="fruit[]" instead of name="fruit" ;)

Cheers,
Scorphus.
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

Some tips regarding HTML Standards:
  • 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:

    Code: Select all

    <input type="text" name="NAME">
    Note that attributes' value can be any case.
  • Always close the tags:

    Code: Select all

    </form>
    </body>
    </html>
Take a look at the W3C's HTML 4.01 Specification. Also, XHTML is the successor of HTML and the standard for HyperText Documents nowadays. Take a look to W3C's XHTML™ 1.0 Recommendation.

Cheers,
Scorphus.
Post Reply