Skip to product information
1 of 1

0penny.com

PHP Script by Script - Volume 1

PHP Script by Script - Volume 1

Regular price $0.99 USD
Regular price Sale price $0.99 USD
Sale Sold out
Shipping calculated at checkout.
Quantity
This e-book should help beginners to learn PHP, but it also should help webmasters to add interesting features to their websites without going in details with PHP programming.

Script #9 : Contact Us Form
Change "" to your e-mail address and save this script as "contact.php".
This script will send comments from "Contact Us" form on your website to your e-mail address.
<?php
$status="Contact Us :";
$mymail = "";
$test=$HTTP_POST_VARS["ftest"];
$subject=$HTTP_POST_VARS["fname"];
$name=$HTTP_POST_VARS["fname"];
$mail=$HTTP_POST_VARS["fmail"];
$comment=$HTTP_POST_VARS["fcomment"];
$subject="Contact from : $subject";
$body="Name : ".$name;
$body=$body."\nE-Mail :".$mail;
$body=$body."\n\n".$comment;
if($test=="1") {
if(mail($mymail,$subject,$body)) {
$status="Thank you for contacting us !"; }
else {
$status="Error !"; }}
?>
<html><head>
<title>Contact Us Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head><body>
<form name="form1" method="post" action="contact.php">
<table width="75%" border="0" cellpadding="4" cellspacing="0" bgcolor="#EEEEEE">
<tr>
<td width="30%"> </td>
<td width="70%"><?php print $status; ?></td>
</tr><tr>
<td width="30%"><div align="right">Name : </div></td>
<td width="70%"><input name="fname" type="text" id="fname"></td>
</tr><tr>
<td width="30%"><div align="right">E-Mail : </div></td>
<td width="70%"><input name="fmail" type="text" id="fmail"></td>
</tr><tr>
<td width="30%"><div align="right">Comment : </div></td>
<td width="70%"><textarea name="fcomment" id="fcomment"></textarea></td>
</tr><tr>
<td width="30%"> </td>
<td width="70%"><input type="submit" name="Submit" value="Submit">
<input name="ftest" type="hidden" id="ftest" value="1"></td>
</tr>
</table>
</form>
</body></html>
Script #10 : Refer a Friend
Simple Refer a Friend script. Save this script as "refer.php".
<?php
$status="Refer a Friend :";
$subject="Great website I have found !";
$test=$HTTP_POST_VARS["ftest"];
$name=$HTTP_POST_VARS["fname"];
$mail = array ($HTTP_POST_VARS["fmail1"], $HTTP_POST_VARS["fmail2"],
$HTTP_POST_VARS["fmail3"] );
$comment=$HTTP_POST_VARS["fcomment"];
$body=$comment."\n".$name;
if ($test=="1"){
for ( $k=1; $k<=3; $k++ ){
mail($mail[$k],$subject,$body);}
$status="Thank you !";}
?>
<html><head>
<title>Refer a Friend Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head><body>
<form name="form1" method="post" action="refer.php">
<table width="75%" border="0" cellpadding="4" cellspacing="0" bgcolor="#EEEEEE">
<tr> <td width="30%"> </td>
<td width="70%"><?php print $status; ?></td>
</tr><tr>
<td width="30%"><div align="right">Your Name :</div></td>
<td width="70%"><input name="fname" type="text" id="fname"></td>
</tr><tr>
<td> </td>
<td>Tell these friends about our website :</td>
</tr><tr>
<td width="30%"><div align="right">E-Mail 1 : </div></td>
<td width="70%"><input name="fmail1" type="text" id="fmail1"></td>
</tr> <tr>
<td><div align="right">E-Mail 2 : </div></td>
<td><input name="fmail2" type="text" id="fmail2"></td>
</tr> <tr>
<td><div align="right">E-Mail 3 : </div></td>
<td><input name="fmail3" type="text" id="fmail3"></td>
</tr><tr>
<td width="30%"><div align="right">Comment : </div></td>
<td width="70%"><textarea name="fcomment" id="fcomment">Hi,
I have found an interesting website.
Hope you will like it, too.
Regards,</textarea></td>
</tr> <tr>
<td width="30%"> </td>
<td width="70%"><input type="submit" name="Submit" value="Submit"> <input name="ftest"
type="hidden" id="ftest" value="1"></td>
</tr></table></form></body></html>
View full details