it shown like this :
QUOTE
Bonus Tutorial
Email Form
n PHP Script
Latest Features
PHP Script hides your email address i.e. no email address in the form.
PHP Script checks for required email (format) & blanks! !
Copy n Paste section now includes code to validate to XTHML 1.0
Overview: This free email contact script includes a check for blank fields and a check for the correct email format i.e. more POWER - all using PHP (NO JAVASCRIPT REQUIRED
For form code that includes more options - types of input, visit the Feedback Form tutorial.
Another example that automatically sends copies to sender is the Free Tell-A-Friend Form tutorial.
The advantage of sending contact email with a php form is that your email address is hidden from spam robots ... that look for 'mailto' in the code.
Required: A PHP host that does NOT block mail() (safe_mode OFF and register_globals on).
VIP: Not sure about the mail() function? Not sure about Safe mode - register globals. See notes at bottom of page.
Step 1: Copy and paste the e-mail Form Code into a 'contact.php' page (must be a html/php page on a server that allows php!).
Step 2: Copy n paste the sendeail.php code into a new file. Change the YourEmail section to include your email address. Then check (or modify) the link at the bottom (contact.php) to point to the desired Next Page. Save the file as 'sendeail.php' (as ASCII file).
Step 3: Upload both files as ASCII i.e. upload the same way as .html files. Be sure both files are in the same folder on the server.
E-mail Form Code (contact.php)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Email Form </title>
</head>
<body>
<form method="post" action="sendeail.php">
<!-- DO NOT change ANY of the php sections -->
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
Your Name: <br />
<input type="text" name="visitor" size="35" />
<br />
Your Email:<br />
<input type="text" name="visitormail" size="35" />
<br /> <br />
<br />
Attention:<br />
<select name="attn" size="1">
<option value=" Sales n Billing ">Sales n Billing </option>
<option value=" General Support ">General Support </option>
<option value=" Technical Support ">Technical Support </option>
<option value=" Webmaster ">Webmaster </option>
</select>
<br /><br />
Mail Message:
<br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<input type="submit" value="Send Mail" />
<br />
Free Code at: <a href="http://www.ibdhost.com/contact/">ibdhost.com/contact/</a>
</form>
</body>
</html>
--------------------------------------------------------------------------------
Code for sendeail.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sendemail Script</title>
</head>
<body>
<!-- Reminder: Add the link for the 'next page' (at the bottom) -->
<!-- Reminder: Change 'YourEmail' to Your real email -->
<?php
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
}
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
}
echo $badinput;
$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = $attn;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";
$from = "From: $visitormail\r\n";
mail("YourEmail", $subject, $message, $from);
?>
<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />
Attention: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<?php echo $ip ?>
<br /><br />
<a href="contact.php"> Next Page </a>
</p>
</body>
</html>
--------------------------------------------------------------------------------
Note: You MUST modify the YourEmail Address and the link (contact.php)!!!
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Safe Mode / Register_globals / Superglobals
How to check that PHP is running and that Safe Mode is OFF !
Use notepad (or other text editor) create an ASCII text file with this line:
<?php phpinfo() ?>
Save that file as test.php
Must be a text file with .php extension - NOT test.php.txt
>Upload test.php (as ASCII file) - to the server
Run test.php from the browser
e.g. www.domain.com/test.php
This will display all the php settings. Use 'find' to check the 'safe' mode section to make sure it is OFF. e.g. look under the Configuration PHP Core Table in the Directive column to see that safe mode is off.
Check that register_globals are on
Use 'find' to check that register_globals are on ! If they need to be turned on - then the settings at your host will determine the method that must be used.
It is difficult to predict the best method for your host, especially if they are not running an apache server. However, if the host is using the latest versions of PHP, it may be best to modify the sendeail.php script by using superglobals
Add this code at the top of sendeail.php:
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];
?>
Other possibilities include:
For apache server, add this : php_flag register_globals on to the .htaccess file.
Create a php.ini file with this : register_globals = on; (or similar depending on your host!)
Note 1: A php.ini or a .htaccess file should be in the same directory (or a higher directory) as the script. Both are ASCII (regular text) files that must be unloaded as text files.
Note 2: To check to see if the change worked, recheck test.php (above) and look at the 'local' column to see if register_globals are now on
Note 3: Some web host block the mail() function if the 'fromemail' is not from your domain. In other words: sometimes, the domain email address must be used - or the mail() function will not work.
After i check your server phpinfo, i found that register_globals = off !!!!
how should i do ???
btw, i was using free hosting from trap17.net


