View Single Post
  #21 (permalink)  
Old 03-14-2009, 12:00 PM
grace55 grace55 is offline
Administrator
Site Admin
 
Join Date: Jun 2008
Posts: 342
Default A journey leads to php....

PROCESSING FORMS

What is one thing almost everyone wants to do with their website? Have a contact form. And, it isn’t as difficult as you’d think. We’re going to use the PHP mail() command to make one.

Make an HTML form with Name, Email and Message fields. Take the code below and place it in a PHP file to use as your action.

<?php
mail("myaccount@myisp.com", "Form Feedback", " // your address and subject
Name: $name
Email: $email
Message: $message
", "From: $email");
// Display results
echo("
<html>
Name: $name
Email: $email
Message: $message
</html>
");
?>


Section Two Overview

In this section, we covered some more advanced features of PHP. Not for the timid, but not impossible to grasp!

IF - Do something if something is true.
ELSE - Do something else if it isn’t
ELSEIF - Add more choices to IF
SWITCH - Use this if you have a lot of ElseIf’s
ARRAY - One variable, many values
ASSOCIATIVE ARRAY - One variable, even more values
LOOPS - For, While, For Each - A way to repeat code
FUNCTIONS - Turn a big code chunk into a small one
SESSIONS - Carry unique data from page to page
COOKIES - Store session data on your viewer’s computer
FORM PROCESSING - Process web forms, such as a mailer


QUIZ

1. What are the 3 ways to comment code in PHP?
2. ELSEIF cannot be used without __
3. What are Cookies used for in PHP?
__________________
Christian Prayer Forum
Reply With Quote