Dr. Andrew Besmer
We will create a todo web app that will link todo items with peoples email addresses. The todo app will be able to support adding/deleting todo items as well as sending a reminder email, reminding a person of the todo item. We will do all this using as much reusable code as possible.
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
include() asks that file
be inserted/parsed
require() demands that a
file be inserted/parsed
<?php
require("header.php");
//Your page stuff here
require("footer.php");
readLines($filename) - Read all the lines from the
fileappendLine($filename, $line) - Append a specific line
from the filedeleteLine($filename, $lineNumber) - Delete a specific
line from the fileinclude() and require() have similar
functions postfixed with _once
include_once()require_once()select tag is used to provide a list of items from
which you can select just one item
name attribute on option element used as
the keyvalue attribute on option used to indicate
choiceoption tags is only shown to
user<select name="state">
<option value="NC">North Carolina</option>
<option value="SC">South Carolina</option>
</select>
select) it belongs tohidden inputs can be used to provide form information
that the user does not get to see
<input type="hidden" name="sku" value="456789"></input>
GET vs POST intentionDELETE but
GET/POST are the only universally supported
form methodsDELETE/PUT in many
browsers
header() functionmail() function in PHP to send mail mail
functionmail($to, $subject, $message, $headers);
$to must follow standard
$subject must contain no \r\n$message can contain multiple lines and is used for the
message body$headers while not required can contain additional
headers
From: is one header you almost certainly want to
setmail("besmera@winthrop.edu",
"New Account",
"Welcome to the site!\r\n\r\nVisit us soon...",
"From: no-reply@winthrop.edu");
OOP or passing the file name would be more suitable than our example but we are not ready for that.↩︎
Source: http://upload.wikimedia.org/wikipedia/commons/f/f3/PostRedirectGet_DoubleSubmitProblem.png↩︎
Source: http://upload.wikimedia.org/wikipedia/commons/3/3c/PostRedirectGet_DoubleSubmitSolution.png↩︎