Hello all,
I'm terribly new at PHP so please bear with me. I've created an e-mail form for interlibrary loaning. The form works just fine but I have been unable to locate the proper way to make it so the form will require certain elements or not be sent. I'm not even sure if that is a PHP option. I would be grateful for any help. I'll include my code below (I know its overly simple.)
The things I wanted to make required were title, author, language, name, phone #, mailing address, library card #, and pickup location.
Thanks in advance.
<?
$title = $REQUEST['title'];
$author = $REQUEST['author'];
$pub = $REQUEST['pub'];
$edit = $REQUEST['edit'];
$oclc = $REQUEST['oclc'];
$not = $REQUEST['not'];
$type = $REQUEST['type'];
$lang = $REQUEST['lang'];
$name = $REQUEST['name'];
$phone = $REQUEST['phone'];
$email = $REQUEST['email'];
$libcard = $REQUEST['libcard'];
$branch = $REQUEST['branch'];
$address = $REQUEST['address'];
$message = "
Name: $name
Phone#: $phone
Address: $address
Library Card: $libcard
Branch: $branch
Title: $title
Author: $author
Publisher: $pub
Edition: $edit
OCLC: $oclc
Not Needed After: $not
Type: $type
Language: $lang";
// prevent email header injection:
$header = "From: " . preg_replace('/[\r\n]+/', '', $email);
mail("email@example.com", "ILL Form", $message, $header);
header( "Location: URL" );
?>