Here's the idea behind the action part. Whatever page you specify for the action is where the form information will go to be processed.
If your contact form is at contact.
php and your action is emailit.
php, then your
php mail function needs to be at emailit.
php.
Heres a simple example...
- Code: Select all
<form action="action.php" method="post">
<label for="Name">Name:
<input type="text" size="25" id="Name" name="Name" tabindex="4" value="" />
</label>
<label for="Email">Email:
<input type="text" size="25" id="Email" name="Email" tabindex="5" value="" />
</label>
<label for="Message">Message:
<textarea cols="40" rows="6" id="Message" name="Message"></textarea>
</label>
<p>
<label for="reset-button" class="button">
<input type="reset" id="reset-button" value="Reset" class="button" tabindex="8" />
</label>
<label for="send-button" class="button">
<input type="submit" id="send-button" value="Send" class="button" tabindex="7" />
</label>
</p>
</form>
...and action.
php would look like this...
- Code: Select all
<?php
$to = "example@example.com";
$name = $_POST['Name'];
$email = $_POST['Email'];
$subject = "...message from $name ($email)";
$message = $_POST['Message'];
$headers = "From: contact@yoursite.com";
mail($to,$subject,$message,$headers);
echo "<h1>thank you...</h1>
<p>Thank you for contacting us!</p>";
?>
You can then use
CSS to style the labels, inputs, and form. You can also add divs or classes in where you need different styles.