Home > Backend Development > PHP Tutorial > Electronic greeting card program using php and mysql_PHP tutorial

Electronic greeting card program using php and mysql_PHP tutorial

WBOY
Release: 2016-07-13 17:21:17
Original
859 people have browsed it

第一步:首先作一个如下面的表单:(注:这个表单里加了php程序)





























 





























if (strlen($g_username) > 1)
{
//判断是否登陆,若已登陆显示姓名及Email,不用填写。
$db=mysql_connect("localhost","root","");
$result=mysql_db_query("数据库名","select email,http from 数据库表名 where username=$g_username");

$row=mysql_fetch_array($result);
$bbs_email=$row[email];

echo "

您的姓名:


$g_username


您的Email:


$bbs_email


";
}
//if (strlen($g_username) < 0)
else //判断没有登陆,需要填写姓名及Email。
{
echo "
您的姓名:





您的Email:



";
}
?>

朋友姓名:




朋友Email:



 




第二步:预览

if (submit=="预览")
{
switch($new)
{
case "newyear":

$new="newyear.gif";
break;

case "newyear2_2":

$query=newyear2_2.gif;
break;

case "newyear3_3":
$query=newyear3_3.gif;
break;

}
}
?>


电子贺卡

















"; ?>




您好朋友:















寄卡给:





您的朋友:






















Step 3: Send greeting card
if(submit=="Send")

$mainurl = "http://lyjrich.oso.com.cn/card"; //The main directory URL of the greeting card file
$dataurl = "$mainurl/store"; //The location where the generated greeting card is stored URL
$userip = getenv("REMOTE_ADDR");
$daten = date("m month d day H o'clock i minute");
$roundno = date("mdHis");
$fileno .=$roundno.".html";
$fileurl = $dataurl."/".$fileno; //Store the URL of the generated greeting card

$subject="A friend mailed it to you greeting card";
$content = eregi_replace("
"," ","$text");

$t_body .= "****************************************** ";
$t_body .= $f_name." Hello: ";
$t_body .= $g_username." I sent you a greeting card from http://lyjrich.oso.com.cn. ";
$t_body .= $g_username." The message to you said: ".$text ." ";
$t_body .= "Please click http://lyjrich.oso.com.cn/card".$fileurl." to enjoy this greeting card ";
$t_body .= "The greeting card will be kept for you for up to one month. ";
$t_body .= " ************************************ ";
$t_body .= "Sending time $daten ";
$t_body .= "************************************** ";
$t_body .= "Free e-cards provided by your web site ";
$t_body .= "Program production: lyjrich(http://lyjrich.oso.com.cn) ";


mail($f_email,$subject,$t_body,"From: ".$email." ");

echo "";

$message ="

E-card













< ;/td>

&l

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532470.htmlTechArticleStep 1: First make a form like the following: (Note: A php program is added to this form) form method ="post" action="mailtocard.php" name="card" onSubmit="return card_Validator(thi...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template