i'm half way through the book, HA!
i know someone knows what i'm trying to do?!?
its two pages and i can't get the second to display
-------publications.html--------
<html>
<head>
<title>Publications</title>
</head>
<body>
<center>
<form action="publications_email.php" method="post">
<input type="hidden" name="file" value="pub1">pub1 effects on the brain<br>
<input type="submit" value="email this to me">
</form>
<br><br><br>
<form action="publications_email.php" method="post">
<input type="hidden" name="file" value="pub2">pub2 effects on the brain<br>
<input type="submit" value="email this to me">
</form>
<br><br><br>
<form action="publications_email.php" method="post">
<input type="hidden" name="file" value="pub3">pub3 effects on the brain<br>
<input type="submit" value="email this to me">
</form>
<br><br><br>
<form action="publications_email.php" method="post">
<input type="hidden" name="file" value="pub4">pub4 effects on the brain<br>
<input type="submit" value="email this to me">
</form>
</center>
</body>
</html>
-------publications_email.php-------
<html>
<head>
<title></title>
</head>
<body>
<center>
<?php
$file = $POST['file'];
$useraddr = $POST['useraddr'];
$sent = $_POST['sent'];
#$form ="<form action=\"pubsend.php\" method=\"post\"><b>Enter your Email address:</b><br><input type=\"text\" size=\"45\" name=\"useraddr\"><br><input type=\"submit\" name=\"sent\" value=\"send it to me\"></form>";
$form ="<form action=\"$_SERVER['PHP_SELF']\" method=\"post\"><b>Enter your Email address:</b><br><input type=\"text\" size=\"45\" name=\"useraddr\"><br><input type=\"submit\" name=\"sent\" value=\"send it to me\"></form>";
#echo( $file );
if( $sent )
{
$valid = true;
if( !useraddr )
{
$errmsg .="Please type in your email:<br>"; $valid = false;
}
else
{
$useraddr = trim( $useraddr );
#patterns for name, domain and top-level domains
$name ="/[-!#$%&\'*+\.\/0-9=?A-Z`{|}~]+";
$host ="([-0-9A-Z]+.)+";
$tlds ="([0-9A-Z]){2,4}$/i";
#check validity of email format
if( !preg_match($name."@".$host.$_tlds,$useraddr) )
{
$errmsg .="email address has incorrect format!<br>";
$valid =false; }
}
}
if( $valid = false ) { echo( $errormsg . $form ); }
else
{
$to ="$useraddr";
$re ="You requested $file from us<br>";
$msg ="Thank you";
$hdr ="From:me@mydomain.com \r\n";
if(mail( $to, $re, $msg, $hdr ) )
{ echo( "an email has been sent to $useraddr with the attachment called $file<br>thanks alot<hr> }
}
?>
</center>
</body>
</html>
-------end------