11-1-2 ¯d¨¥ºô¶»P¯d¨¥Àx¦s
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-25
|
11-1-2 ¯d¨¥ºô¶»P¯d¨¥Àx¦s
11-1-2 ¯d¨¥ºô¶»P¯d¨¥Àx¦s
·í§ÚÌn¦bºô¶¤¤´£¨Ñ¤@Ó¥i¥HÅýºô¤Íµoªí·N¨£©Î¤Ï¬Mªº¯d¨¥ªO®É¡A¥²¶·¥ý³]p¤@Ó¡y·N¨£µoªíªí³æ¡]addmsg.php¡^¡z¡AÅýºô¤Í¥i¥H¦b¤W±µoªí·N¨£¡A¨Ã¥Bn¯à±N³o¨Ç·N¨£¸ê®Æ°eµ¹§Ú̳B²z¯d¨¥¸ê®ÆªºPHPµ{¦¡¡yadd.php¡z¨Ó°O¿ý¥H¤Î³B²z³o¨Ç·N¨£¸ê®Æ¡C
²{¦b½Ð¥´¶}addmsg.phpºô¶¡A¨Ó¤F¸Ñ¤@¤U¦p¦ó»s§@¤@Ó¥i¥HÅýºô¤Í¦b¤W±µoªí·N¨£ªºªí³æ¡G
¹Ï11-5 addmsg.phpºô¶¡C
½s¸¹ | Äæ¦ì | Äæ¦ì¦WºÙ | ªí³æ¤¸¥ó | ¢° | ¯d¨¥¥DÃD | subject
| ³æ¦æ¤å¦r¤è¶ô | ¢± | ±zªº¤j¦W | parent | ³æ¦æ¤å¦r¤è¶ô | ¢² | E-Mail | email | ³æ¦æ¤å¦r¤è¶ô | ¢³ | ¥Nªí¹Ï§Î | pic | ¿ï¾Ü¶s | ¢´ | ¯d¨¥©Ê½è | personal | ¤U©Ô¦¡¥\¯àªí | ¢µ | ¯d¨¥¤º®e | memo | ¦h¦æ¤å¦r¤è¶ô | ¢¶ | °e¥X·N¨£ | Submit | «ö¶s | ¢· | ²M°£«¼g | ¡þ | «ö¶s |
¡y¯d¨¥¥DÃD¡zºô¶±Ôz¼ÐÅÒ- <input type="text" name="subject" size="50" maxlength="20">
½Æ»s¥N½X ¡y±zªº¤j¦W¡zºô¶±Ôz¼ÐÅÒ- <input type="text" name="parent" size="20" maxlength="20">
½Æ»s¥N½X ¡yE-Mail¡zºô¶±Ôz¼ÐÅÒ- <input type="text" name="email" size="35" maxlength="40">
½Æ»s¥N½X ¡y¥Nªí¹Ï§Î¡zºô¶±Ôz¼ÐÅÒ- <input type="radio" name="pic" value="1" checked >
- <img src="1.gif">
- <input type="radio" name="pic" value="2"><img src="2.gif">
- <input type="radio" name="pic" value="3"><img src="3.gif">
- <input type="radio" name="pic" value="4"><img src="4.gif">
- <input type="radio" name="pic" value="5"><img src="5.gif">
- <input type="radio" name="pic" value="6"><img src="6.gif">
- <input type="radio" name="pic" value="7"><img src="7.gif">
- <input type="radio" name="pic" value="8"><img src="8.gif">
- <input type="radio" name="pic" value="9"><img src="9.gif">
- <input type="radio" name="pic" value="10"><img src="10.gif">
½Æ»s¥N½X ¡y¯d¨¥©Ê½è¡zºô¶±Ôz¼ÐÅÒ- <select name="personal" size="1">
- <option value="0" selected>¤j®a¨Ó°Q½×</option>
- <option value="1">¥uµ¹ªO¥D¬Ý</option>
- </select>
½Æ»s¥N½X ¡y¯d¨¥¤º®e¡zºô¶±Ôz¼ÐÅÒ- <textarea name="memo" cols="50" rows="4" ></textarea>
½Æ»s¥N½X |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-25
|
½Ð¯S§Oª`·N¡G§Ú̪í³æªº¦WºÙ¬°¡yAddmsg¡z¡A¦Óªí³æ¤º®e¸ê®Æªº¶Ç°e¤è¦¡¬°¡yPost¡z¡A³B²z·N¨£¸ê®ÆªºPHPµ{¦¡¬O¡yadd.php¡z.- <form name="addmsg" method="POST" action="add.php">
½Æ»s¥N½X §¹¾ãºô¶¤º®e¦Cªí¦p¤U¡G
addmsg.php- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=big5">
- <title>³Â»¶®a±Ú¯d¨¥ªO</title>
- </head>
- <body>
- <div align="center">
- <p align="center">
- <font size="2">
- <img src="title.gif">
- </font>
- <br>
- <font size="2"><a href="guest.php">
- <img border="0" src="team2.gif" align="absmiddle">
- ¬Ý¬Ýºô¤Í̪º·N¨£<img border="0" src="team2.gif" align="absmiddle">
- </a></font> </div>
- <form name="addmsg" method="POST" action="add.php">
- <div align="center">
- <table border="1" cellspacing="0" style="border-collapse: collapse"
- bordercolor="#FFFFFF" cellpadding="0">
- <tr><td bgcolor="#339933" align="center" valign="middle" width="147">
- <font color="#FFFFFF" size="2">¯d¨¥¥DÃD</font></td>
- <td height="25" bgcolor="#E8FFE8"><font size="2">
- <input type="text" name="subject" size="50" value maxlength="20">
- </font></td></tr> <tr>
- <td bgcolor="#339933" align="center" valign="middle" width="147">
- <font color="#FFFFFF" size="2">±zªº¤j¦W</font></td>
- <td height="25" bgcolor="#E8FFE8"><font size="2">
- <input type="text" name="name" size="20" maxlength="20"></font></td>
- </tr>
- <tr>
- <td bgcolor="#339933" align="center" valign="middle" width="147">
- <font color="#FFFFFF" size="2">E-Mail</font></td>
- <td height="25" bgcolor="#E8FFE8"><font size="2">
- <input type="text" name="email" size="35" maxlength="40"></font></td>
- </tr>
- <tr>
- <td bgcolor="#339933" align="center" height="27" valign="middle" width="147">
- <font size="2" color="#FFFFFF">¥Nªí¹Ï§Î</font></td>
- <td height="27" bgcolor="#E8FFE8">
- <font size="2">
- <input type="radio" name="pic" value="1" checked ><img src="1.gif">
- <input type="radio" name="pic" value="2"><img src="2.gif">
- <input type="radio" name="pic" value="3"><img src="3.gif">
- <input type="radio" name="pic" value="4"><img src="4.gif">
- <input type="radio" name="pic" value="5"><img src="5.gif">
- <input type="radio" name="pic" value="6"><img src="6.gif">
- <input type="radio" name="pic" value="7"><img src="7.gif">
- <input type="radio" name="pic" value="8"><img src="8.gif">
- <input type="radio" name="pic" value="9"><img src="9.gif">
- <input type="radio" name="pic" value="10"><img src="10.gif">
- </font>
- </td>
- </tr>
- <!--¨p¤H¯d¨¥©Î¤½¶}-->
- <tr>
- <td bgcolor="#339933" align="center" width="147">
- <font color="#FFFFFF" size="2">¯d¨¥©Ê½è</font></td>
- <td bgcolor="#E8FFE8">
- <font size="2">
- <select name="personal" size="1">
- <option value="0" selected>¤j®a¨Ó°Q½×</option>
- <option value="1">¥uµ¹ªO¥D¬Ý</option>
- </select>
- </font>
- </td>
- </tr>
- <!--¯d¨¥¤º®eÄæ¦ì-->
- <tr>
- <td bgcolor="#339933" align="Center" height="98" valign="middle" width="147">
- <font color="#FFFFFF" size="2">¯d¨¥¤º®e¡G</font>
- </td>
- <td height="98" valign="middle" bgcolor="#E8FFE8">
- <font size="2">
- <textarea name="memo" cols="50" rows="4" ></textarea>
- </font>
- </td></tr><tr><td align="Center" colspan="2">
- <font size="2"><input type="submit"value="°e¥X·N¨£">
- <input type="reset" value="«¶ñ¸ê®Æ"></font></td>
- </tr></table></div>
- </form></center>
- </body></html>
½Æ»s¥N½X |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-25
|
¯d¨¥³B²zµ{¦¡
·íºô¤Í¦b¡u·N¨£µoªíªí³æ¡v¤¤¶ñ¼g¦n¬ÛÃö¸ê®Æ¡AµM«á«ö¤U¡u°e¥X·N¨£¡v«ö¶s¡Aªí³æ¤¤ªº¸ê®Æ¤º®e´N·|¥H¡yPOST¡zªº¤è¦¡¥ÑSEVERºÝŪ¨ú¡A¦]¬°§Ú̦bªí³æ¶Ç°eªºAction°Ñ¼Æ«ü©wServerºÝ³B²z¦¹¤@ªí³æ¸ê®Æ¤º®eªºµ{¦¡¬°¡yadd.php¡z¡A¦]¦¹§ÚÌ´N¥²¶·¨Ó¼¶¼g¯à°÷³B²z³o¨Ç·N¨£¸ê®ÆªºPHPµ{¦¡¡yadd.php¡z¡C
¦b³oÓ³B²z·N¨£¸ê®ÆªºPHPµ{¦¡¡A§ÚÌ¥i¤À¬°¤U¦C´XÓ³¡¤À¡G
1.±µ¦¬¨Ó¦Û¡y·N¨£µoªíªí³æ¡z¤¤ªº¦UÄæ¦ì¸ê®Æ
n±Nºô¤Íµo¨¥¸ê®Æ§@«áÄò³B²z¤Î±N³o¨Ç¸ê®Æ¤º®e¦s¤J¸ê®Æ®w¤§«e¡A§ÚÌ¥²¶·¥ý§â¦UÓÄæ¦ìªº¸ê®Æ©Ó±µ¤U¨Ó¡G- //±µ¦¬addmsg.php¶Ç¨Óªº¸ê°T
- $subject=$_REQUEST["subject"];
- $name = $_REQUEST["name"];
- $email = $_REQUEST["email"];
- $pic=$_REQUEST["pic"];
- $memo=nl2br($_REQUEST["memo"]);
- $personal = $_REQUEST["personal"];
½Æ»s¥N½X ¨ä¤¤¤ñ¸û¯S§Oªº¬O¯d¨¥¤º®e¡umemo¡vªº¸ê®Æ³B²z¡A¯d¨¥¤º®eÄæ¦ì¬O¦h¦æ¤å¦r¿é¤J¤¸¥ó¡A·í§Ú̱N¿é¤J©ó¦h¦æ¤å¦r¿é¤J¤¸¥óªº¸ê®ÆÅã¥Ü¥X¨Ó®É¡A·|¦³¤@ÓÂ_¦æªº°ÝÃD¡A¿é¤J¸ê®Æ®É¡A¦b¦h¦æ¤å¦r¿é¤J¤¸¥ó¤¤«ö¤U¡uEnter¡v·|¦³´«¦æªº®ÄªG¡AÁöµM¦bªí±¤W¬Ý¤£¨ì¥ô¦óªº´«¦æ¦r¤¸¡A¦ý¹ê»Ú¤W«o¯u¹ê¦s¦bµÛ¤@Ó´«¦æ¦r¤¸¡u\r\n¡v¡A³oÓ´«¦æ¦r¤¸¦b§ÚÌ¿é¥X¨ìÂsÄý¾¹®É¨Ã¤£·|¦³´«¦æªº®ÄªG¡A¦]¦¹¡A¿é¥X®ÉÀ³¥ý¨Ï¥Î¡ustr_replace()¡v¨ç¼Æ±N³oÓ´«¦æ¦r¤¸¡u\r\n¡v´À´«¦¨¡u<Br>¡vªºHTML¼ÐÅҲŸ¹¡C
2.«Ø¥ßchgStr¨ç¼Æ
¥Ñ©óºô¤Íµo¨¥ªº¸ê®Æ¥²¶·¥H³æ¤Þ¸¹¬A°_¨Óªºªº«¬¦¡»PInsert Into«ü¥Oµ²¦X¦b¤@°_¡A¦pªGºô¤Íµo¨¥ªº¸ê®Æ¤º®e쥻´N¨Ï¥Î¤F³æ¤Þ¸¹¡A±N·|¨Ïµ{¦¡²£¥Í¿ù»~¡A¦]¦¹§ÚÌ´N¥ý¦Û¦æ«Ø¥ß¤@ÓchgStr¨ç¼Æ¡A±Nºô¤Íµo¨¥ªº¸ê®Æ¤º®e¥ý¸g¹LchgStr¨ç¼Æ¹LÂo¡AY¸ê®Æ¤º®e§t¦³³æ¤Þ¸¹«h±N³æ¤Þ¸¹Âà´«¬°Âù¤Þ¸¹¡G- //±N³æ¤Þ¸¹¸m´«¬°Âù¤Þ¸¹
- Function chgStr($data)
- {
- $chgStr = "'" . str_replace("'", "''", $data) . "'";
- return $chgStr;
- }
½Æ»s¥N½X 3.«Ø¥ß»P¸ê®Æ®wªº³sµ²
n±N©Ó±µ¤U¨Óªº¦UÓÄæ¦ìªº¸ê®Æ¼g¤J¸ê®Æ®w¤§«e¡A¥²¶·¥ý«Ø¥ß»P¸ê®Æ®wªº³sµ²¡Amysql_connect()»Pmysql_select_db()¨ç¼Æªº¨Ï¥Î¡A¤§«e§Ṳ́w¸g½Í¹L¤£¦bÂب¥¡G- //³sµ²SQL Server
- $conn = mysql_connect("127.0.0.1", "sa", "12345");
- //¿ï¾Ü¸ê®Æ®w
- mysql_select_db("Message", $conn);
- //«ü©w´£¨ú¸ê®Æªº®Õ¹ï¦r¤¸ªí
- mysql_query("set character set big5");
½Æ»s¥N½X |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-25
|
4.«Ø¥ß·s¼W¸ê®Æ¿ýªºInsert Into«ü¥O
Insert Into«ü¥O±Ôz®æ¦¡¡G- Insert Into ¸ê®Æªí¦W (Äæ¦ì¦W) values (Äæ¦ìÈ)
½Æ»s¥N½X ³oºØ´¡¤J·s¸ê®Æ¿ýªº®æ¦¡¤S¥i¤À¬°¨âºØ§Î¦¡¡G
³v¤@±NÄæ¦ìȳ]©wµ¹¬Û¹ïÀ³ªºÄæ¦ì¡AµM«á¦A·s¼W¦Ü¸ê®Æªí¤¤¡A¨Ò¦p¡G
¥t¤@ºØ¤è¦¡»P¤W¤@ºØ®æ¦¡¹p¦P¡A¦ý¬O¬Ù²¤¤FÄæ¦ì¦WºÙ¡G
«Øij¾¨¶qÁקK¨Ï¥Î²Ä¤GºØ¤è¦¡¡A¦]¬°¤Ö¤FÄæ¦ì¹ïÀ³«Ü®e©öµo¥Í¸ê®Æ»~¶ñªº±¡ªp¡I
«Ø¥ß»P¸ê®Æ®wªº³sµ²«á¡A§Ú̺¥ý²Õ¦X±N·s¼W¸ê®Æ¿ýªºInstert Into«ü¥O¡AµM«á¦A¼g¤J¸ê®Æ®wÀɮפ¤¡G- //±N¸ê®Æ¼g¤J¸ê®Æ®w
- $sql = "Insert Into allmessage (ºô¤Í©m¦W, ¯d¨¥¥DÃD, Ápµ¸«H½c, ¯d¨¥¤º®e, ¨p¤H¤½¶}, ¹Ï§Î, ¯d¨¥®É¶¡) Values (";
- $sql = $sql . chgStr($name) . ",";
- $sql = $sql . chgStr($subject) . ",";
- $sql = $sql . chgStr($email) . ",";
- $sql = $sql . chgStr($memo) . ",";
- $sql = $sql . chgStr($personal) . ",";
- $sql = $sql . $pic . ",'";
- $sql = $sql . date("Y-m-j H:i:s") . "')";
- mysql_query($sql);
½Æ»s¥N½X 5¡BÂà¦V¦ÜÅã¥Ü¯d¨¥·N¨£ªººô¶guest.php
·íºô¤Íµo¨¥ªº¸ê®Æ¤º®e³B²z§¹²¦¨ÃÀx¦s¦Ü¸ê®Æ®wÀɮפ¤«á¡A§ÚÌ«h¥²¶·±Nºô¶Âà¦V¦ÜÅã¥Ü¯d¨¥·N¨£ªººô¶guest.php¡A¦p¦¹¤@¨Ó¡Aµo¨¥ªººô¤Í´N¥i¬Ý¨£¥Lªºµo¨¥¬O§_¤w¸g¶¶§Qªºµn¿ý¡G- //±Nºô¶Âà¦V¦ÜÅã¥Ü¯d¨¥·N¨£ªººô¶guest.php
- header("Location: guest.php");
½Æ»s¥N½X add.php- <?
- //±µ¦¬addmsg.php¶Ç¨Óªº¸ê°T
- $subject=$_REQUEST["subject"];
- $name = $_REQUEST["name"];
- $email = $_REQUEST["email"];
- $pic=$_REQUEST["pic"];
- $memo=nl2br($_REQUEST["memo"]);
- $personal = $_REQUEST["personal"];
- //³sµ²MySQL Server
- $conn = mysql_connect("localhost", "root", "12345a");
- //¿ï¾Ü¸ê®Æ®w
- mysql_select_db("Message", $conn);
- //«ü©w´£¨ú¸ê®Æªº®Õ¹ï¦r¤¸ªí
- mysql_query("set character set big5");
- //±N³æ¤Þ¸¹¸m´«¬°Âù¤Þ¸¹
- Function chgStr($data)
- {
- $chgStr = "'" . str_replace("'", "''", $data) . "'";
- return $chgStr;
- }
- //±N¸ê®Æ¼g¤J¸ê®Æ®w
- $sql = "Insert Into allmessage (ºô¤Í©m¦W, ¯d¨¥¥DÃD, Ápµ¸«H½c, ¯d¨¥¤º®e, ¨p¤H¤½¶}, ¹Ï§Î, ¯d¨¥®É¶¡) Values (";
- $sql = $sql . chgStr($name) . ",";
- $sql = $sql . chgStr($subject) . ",";
- $sql = $sql . chgStr($email) . ",";
- $sql = $sql . chgStr($memo) . ",";
- $sql = $sql . chgStr($personal) . ",";
- $sql = $sql . $pic . ",'";
- $sql = $sql . date("Y-m-j H:i:s") . "')";
- mysql_query($sql);
- //±Nºô¶Âà¦V¦ÜÅã¥Ü¯d¨¥·N¨£ªººô¶guest.php
- header("Location: guest.php");
- ?>
½Æ»s¥N½X |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|