|
|
|
เพิ่มข้อมูลลงฐานข้อมูลได้คนเดียวครับ ไม่รู้ผิดตรงไหน รบกวนช่วยดู code ด้วยครับ |
|
|
|
|
|
|
|
ไฟล์ form.php
Code (PHP)
<html>
<head>
<title>Ãкº¢éÍÁÙźؤÅÒ¡ÃÍ͹äÅ·ì</title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<script language="JavaScript" type="text/javascript">
<!--
function checkform ( form )
{
if (form.name.value == "") {
alert( "â»Ã´¡ÃÍ¡ ª×èÍ-¹ÒÁÊ¡ØÅ ´éÇÂ" );
form.name.focus();
return false ;
}
if (form.cid.value == "") {
alert( "â»Ã´¡ÃÍ¡ËÁÒÂàÅ¢ºÑµÃ»ÃЪҪ¹¤ÃѺ" );
form.cid.focus();
return false ;
}
if (form.year.value == "") {
alert( "â»Ã´¡ÃÍ¡»Õ ¾.È." );
form.year.focus();
return false ;
}
if (form.address.value == "") {
alert( "â»Ã´¡ÃÍ¡·ÕèÍÂÙè»Ñ¨¨ØºÑ¹´éǤÃѺ" );
form.address.focus();
return false ;
}
if (form.degree.value == "") {
alert( "â»Ã´¡ÃÍ¡ÇزԡÒÃÈÖ¡ÉÒ" );
form.degree.focus();
return false ;
}
if (form.major.value == "") {
alert( "â»Ã´¡ÃÍ¡ ÊÒ¢Ò ÇÔªÒàÍ¡" );
form.major.focus();
return false ;
}
if (form.position.value == "") {
alert( "â»Ã´¡ÃÍ¡µÓá˹è§" );
form.position.focus();
return false ;
}
if (form.address_w.value == "") {
alert( "â»Ã´¡Ã͡ʶҹ·Õè·Ó§Ò¹" );
form.address_w.focus();
return false ;
}
return true ;
}
-->
</script>
<style>
BODY {
FONT-FAMILY: Arial, Helvetica, sans-serif
}
</style>
</head>
<body bgcolor="#FFFFFF">
<div align="center"><img src="images/nfe.png" width=100 height=100></div>
<div align="center"><font color="#0033CC" size="4">Ãкº¢éÍÁÙźؤÅÒ¡ÃÍ͹äÅ·ì <br>
Êӹѡ§Ò¹ ¡È¹.¨Ñ§ËÇÑ´ÍغÅÃÒª¸Ò¹Õ
</font></div>
<p>
<font color="#FF0033" size="2"><div align="center">*** ¡ÃسҡÃÍ¡¢éÍÁÙźؤÅÒ¡ÃãËé¤Ãº¶éǹ ***</div></font>
</p>
<!-- ÊèǹËÑǢͧ¿ÍÃìÁ·Õèà»ç¹¡Òú͡ÇèÒ¨ÐãËéä»Ë¹éÒä˹ ËÅѧ¡´»ØèÁ Submit -->
<form action="form_in.php" method="post" onsubmit="return checkform(this);" >
<table border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#993333" width="900">
<td><font color="#FFFFFF">
¢éÍÁÙÅÊèǹµÑÇ
</td>
<tr>
<td bgcolor="#FFFFFF"><p><font size="2">
ª×èÍ - ¹ÒÁÊ¡ØÅ </font></p></td>
<td bgcolor="#FFFFFF">
<select name="fn" >
<option>¤Ó¹Ó˹éÒ</option>
<option value="¹ÒÂ">¹ÒÂ</option>
<option value="¹Ò§ÊÒÇ">¹Ò§ÊÒÇ</option>
<option value="¹Ò§">¹Ò§</option>
</select>
<input name="name" type="text" size="30" style="width: 100px" maxlength="100">
<input name="fname" type="text" size="30" style="width: 100px" maxlength="100"></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><p><font size="2">
ËÁÒÂàÅ¢ºÑµÃ»ÃЪҪ¹</font></td>
<td bgcolor="#FFFFFF">
<input name="cid" type="text" size="30" style="width: 100px" maxlength="13"><font color="#FF0000">***</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> <font size="2"> Çѹ·Õèà´×͹»Õà¡Ô´</font></td>
<td bgcolor="#FFFFFF"><font size="2">Çѹ·Õè
<select name="date">
<option value=1 selected>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
<option value=8>8</option>
<option value=9>9</option>
<option value=10>10</option>
<option value=11>11</option>
<option value=12>12</option>
<option value=13>13</option>
<option value=14>14</option>
<option value=15>15</option>
<option value=16>16</option>
<option value=17>17</option>
<option value=18>18</option>
<option value=19>19</option>
<option value=20>20</option>
<option value=21>21</option>
<option value=22>22</option>
<option value=23>23</option>
<option value=24>24</option>
<option value=25>25</option>
<option value=26>26</option>
<option value=27>27</option>
<option value=28>28</option>
<option value=29>29</option>
<option value=30>30</option>
<option value=31>31</option>
</select>
à´×͹
<select name="month">
<option value="1" selected>Á¡ÃÒ¤Á</option>
<option value=2>¡ØÁÀҾѹ¸ì</option>
<option value=3>ÁÕ¹Ò¤Á</option>
<option value=4>àÁÉÒ¹</option>
<option value=5>¾ÄÉÀÒ¤Á</option>
<option value=6>ÁԶعÒ¹</option>
<option value=7>¡Ã¡®Ò¤Á</option>
<option value=8>ÊÔ§ËÒ¤Á</option>
<option value=9>¡Ñ¹ÂÒ¹</option>
<option value=10>µØÅÒ¤Á</option>
<option value=11>¾ÄȨԡÒ¹</option>
<option value=12>¸Ñ¹ÇÒ¤Á</option>
</select>
¾.È.
<input name="year" type="text" size="5" maxlength="5">
</font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><font size="2"> ʶҹÐÀÒ¾</font></td>
<td bgcolor="#FFFFFF"><font size="2">
<input name="s_marry" type="radio" value="âÊ´" checked>
âÊ´
<input name="s_marry" type="radio" value="ÊÁÃÊ" checked>
ÊÁÃÊ
<input name="s_marry" type="radio" value= "ËÂèÒÃéÒ§"> ËÂèÒÃéÒ§</font>
</tr>
<tr>
<td bgcolor="#FFFFFF"><p><font size="2">
ª×èÍ - ¹ÒÁÊ¡ØÅ ¤ÙèÊÁÃÊ</font></p></td>
<td bgcolor="#FFFFFF">
<input name="marryname" type="text" size="30" style="width: 227px" maxlength="100"></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><p><font size="2">
¨Ó¹Ç¹ºØµÃ</font></p></td>
<td bgcolor="#FFFFFF">
<font size="2" ><input name="child" type="text" size="30" style="width: 100px" maxlength="100">¤¹</font></td>
<tr>
<td bgcolor="#FFFFFF"><font size="2"> ·ÕèÍÂÙè»Ñ¨¨ØºÑ¹</font></td>
<td bgcolor="#FFFFFF"><font size="2">
<textarea name="address" cols="20" rows="2" wrap="virtual"></textarea>
</font></td>
<tr>
<td bgcolor="#FFFFFF"><p><font size="2">
ËÁÒÂàÅ¢â·ÃÈѾ·ì</font></p></td>
<td bgcolor="#FFFFFF">
<input name="phone" type="text" size="30" style="width: 100px" maxlength="10"></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><p><font size="2">
ÍÕàÁÅì</font></p></td>
<td bgcolor="#FFFFFF">
<input name="mail" type="text" size="30" style="width: 180px" maxlength="100"></td>
</tr>
<td><font color="#FFFFFF">
»ÃÐÇѵԡÒÃÈÖ¡ÉÒ
</td>
<tr>
<td bgcolor="#FFFFFF"><p><font size="2">
ÇزԡÒÃÈÖ¡ÉÒÊÙ§ÊØ´</font></p></td>
<td bgcolor="#FFFFFF">
<input name="degree" type="text" size="30" style="width: 120px" maxlength="60"> <font color="#FF0033" size="2">àªè¹ Ç·.º ¤º. ¡È.º.</font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><p><font size="2">
ÇÔªÒàÍ¡/ÊÒ¢ÒÇÔªÒ</font></p></td>
<td bgcolor="#FFFFFF">
<input name="major" type="text" size="30" style="width: 150px" maxlength="100"> <font color="#FF0033" size="2">àªè¹ ÇÔ·ÂÒ¡ÒäÍÁ¾ÔÇàµÍÃì </font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><p><font size="2">
ʶҺѹ/ÁËÒÇÔ·ÂÒÅÑÂ</font></p></td>
<td bgcolor="#FFFFFF">
<input name="institute" type="text" size="30" style="width: 150px" maxlength="100"> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> <font size="2">   Çѹ·Õ診¡ÒÃÈÖ¡ÉÒ</font></td>
<td bgcolor="#FFFFFF"><font size="2">Çѹ·Õè
<select name="date2">
<option value=1 selected>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
<option value=8>8</option>
<option value=9>9</option>
<option value=10>10</option>
<option value=11>11</option>
<option value=12>12</option>
<option value=13>13</option>
<option value=14>14</option>
<option value=15>15</option>
<option value=16>16</option>
<option value=17>17</option>
<option value=18>18</option>
<option value=19>19</option>
<option value=20>20</option>
<option value=21>21</option>
<option value=22>22</option>
<option value=23>23</option>
<option value=24>24</option>
<option value=25>25</option>
<option value=26>26</option>
<option value=27>27</option>
<option value=28>28</option>
<option value=29>29</option>
<option value=30>30</option>
<option value=31>31</option>
</select>
à´×͹
<select name="month2">
<option value="1" selected>Á¡ÃÒ¤Á</option>
<option value=2>¡ØÁÀҾѹ¸ì</option>
<option value=3>ÁÕ¹Ò¤Á</option>
<option value=4>àÁÉÒ¹</option>
<option value=5>¾ÄÉÀÒ¤Á</option>
<option value=6>ÁԶعÒ¹</option>
<option value=7>¡Ã¡®Ò¤Á</option>
<option value=8>ÊÔ§ËÒ¤Á</option>
<option value=9>¡Ñ¹ÂÒ¹</option>
<option value=10>µØÅÒ¤Á</option>
<option value=11>¾ÄȨԡÒ¹</option>
<option value=12>¸Ñ¹ÇÒ¤Á</option>
</select>
¾.È.
<input name="year2" type="text" size="5" maxlength="5">
</font></td>
</tr>
<td><font color="#FFFFFF">
ʶҹ·Õè·Ó§Ò¹
</td>
<tr>
<td bgcolor="#FFFFFF"><p><font size="2">
µÓá˹è§</font></p></td>
<td bgcolor="#FFFFFF">
<select name="position" id="positon">
<option>¡ÃسÒàÅ×Í¡µÓá˹è§</option>
<option value="¼ÙéÍӹǡÒÃÊӹѡ§Ò¹ ¡È¹.¨Ñ§ËÇÑ´">¼ÙéÍӹǡÒÃÊӹѡ§Ò¹ ¡È¹.¨Ñ§ËÇÑ´</option>
<option value="Ãͧ¼ÙéÍӹǡÒÃÊӹѡ§Ò¹ ¡È¹.¨Ñ§ËÇÑ´">Ãͧ¼ÙéÍӹǡÒÃÊӹѡ§Ò¹ ¡È¹.¨Ñ§ËÇÑ´</option>
<option value="¼ÙéÍӹǡÒà ¡È¹.ÍÓàÀÍ">¼ÙéÍӹǡÒà ¡È¹.ÍÓàÀÍ</option>
<option value="¤ÃÙªÓ¹Ò¡ÒþÔàÈÉ">¤ÃÙªÓ¹Ò¡ÒþÔàÈÉ</option>
<option value="¤ÃÙªÓ¹Ò¡ÒÃ">¤ÃÙªÓ¹Ò¡ÒÃ</option>
<option value="¤ÃÙ">¤ÃÙ</option>
<option value="ºÃóÒÃѡɪӹҡÒÃ">ºÃóÒÃÑ¡ÉìªÓ¹Ò¡ÒÃ</option>
<option value="ºÃóÒÃÑ¡Éì">ºÃóÒÃÑ¡Éì</option>
<option value="¾¹Ñ¡§Ò¹¾ÔÁ¾ì´Õ´ªÑé¹ 1">¾¹Ñ¡§Ò¹¾ÔÁ¾ì´Õ´ªÑé¹ 1</option>
<option value="¾¹Ñ¡§Ò¹¾ÔÁ¾ì´Õ´ªÑé¹ 2">¾¹Ñ¡§Ò¹¾ÔÁ¾ì´Õ´ªÑé¹ 3</option>
<option value="¹Ñ¡ÇÔà¤ÃÒÐËì¹âºÒÂáÅÐá¼¹">¹Ñ¡ÇÔà¤ÃÒÐËì¹âºÒÂáÅÐá¼¹</option>
<option value="¹Ñ¡ÇÔªÒ¡ÒäÍÁ¾ÔÇàµÍÃì">¹Ñ¡ÇÔªÒ¡ÒäÍÁ¾ÔÇàµÍÃì</option>
<option value="¹Ñ¡ÇÔªÒ¡ÒÃÈÖ¡ÉÒ">¹Ñ¡ÇÔªÒ¡ÒÃÈÖ¡ÉÒ</option>
<option value="¹Ñ¡¡ÒèѴ¡Ò÷ÑèÇä»">¹Ñ¡¡ÒèѴ¡Ò÷ÑèÇä»</option>
<option value="¹Ñ¡ÇÔªÒ¡ÒþÑÊ´Ø">¹Ñ¡ÇÔªÒ¡ÒþÑÊ´Ø</option>
<option value="¹Ñ¡ÇÔªÒ¡ÒÃà§Ô¹áÅкѪÕ">¹Ñ¡ÇÔªÒ¡ÒÃà§Ô¹áÅкѪÕ</option>
<option value="¾¹Ñ¡§Ò¹ÃÒª¡ÒÃ">¾¹Ñ¡§Ò¹ÃÒª¡ÒÃ(¤ÃÙÍÒÊÒ)</option>
<option value="¾¹Ñ¡§Ò¹ÃÒª¡ÒÃ">¾¹Ñ¡§Ò¹ÃÒª¡Òà (¤ÃÙ Èê.) </option>
<option value="¤ÃÙÊ͹¤¹¾Ô¡ÒÃ">¤ÃÙÊ͹¤¹¾Ô¡ÒÃ</option>
<option value="¤ÃÙ »Çª.">¤ÃÙ »Çª.</option>
<option value="¤ÃÙÊ͹à´ç¡àÃèÃè͹">¤ÃÙÊ͹à´ç¡àÃèÃè͹</option>
<option value="¾¹Ñ¡§Ò¹ÃÒª¡ÒÃ">¾¹Ñ¡§Ò¹ºÃÔ¡ÒÃ</option>
<option value="¾¹Ñ¡§Ò¹ÃÒª¡ÒÃ">¾¹Ñ¡§Ò¹¢ÑºÃ¶Â¹µì </option>
</select> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><p><font size="2">
˹èǧҹ</font></p></td>
<td bgcolor="#FFFFFF">
<div align="left">
<select name="dept" id="dept">
<option>¡ÃسÒàÅ×͡˹èǧҹ</option>
<option value="¡È¹.ÍÓàÀÍàÁ×ͧ">¡È¹.ÍÓàÀÍàÁ×ͧ</option>
<option value="¡È¹.ÍÓàÀÍ¡Ø´¢éÒÇ»Øé¹">¡È¹.ÍÓàÀÍ¡Ø´¢éÒÇ»Øé¹</option>
<option value="¡È¹.à¢ÁÃÒ°">¡È¹.ÍÓàÀÍà¢ÁÃÒ°</option>
<option value="¡È¹.ÍÓàÀÍà¢×èͧã¹">¡È¹.ÍÓàÀÍà¢×èͧã¹</option>
<option value="¡È¹.ÍÓàÀÍ⢧à¨ÕÂÁ">¡È¹.ÍÓàÀÍ⢧à¨ÕÂÁ</option>
<option value="¡È¹.ÍÓàÀʹ͹Á´á´§">¡È¹.ÍÓàÀʹ͹Á´á´§</option>
<option value="¡È¹.ÍÓàÀÍà´ªÍØ´Á">¡È¹.ÍÓàÀÍà´ªÍØ´Á</option>
<option value="¡È¹.ÍÓàÀ͵ÃСÒþת¼Å">¡È¹.ÍÓàÀ͵ÃСÒþת¼Å</option>
<option value="¡È¹.ÍÓàÀ͵ÒÅÊØÁ">¡È¹.ÍÓàÀ͵ÒÅÊØÁ</option>
<option value="¡È¹.ÍÓàÀ͹ҨÐËÅÇÂ">¡È¹.ÍÓàÀ͹ҨÐËÅÇÂ</option>
<option value="¡È¹.ÍÓàÀÍ·Øè§ÈÃÕÍØ´Á">¡È¹.ÍÓàÀÍ·Øè§ÈÃÕÍØ´Á</option>
<option value="¡È¹.ÍÓàÀ͹ҵÒÅ">¡È¹.ÍÓàÀ͹ҵÒÅ</option>
<option value="¡È¹.ÍÓàÀ͹ÒàÂÕÂ">¡È¹.ÍÓàÀ͹ÒàÂÕÂ</option>
<option value="¡È¹.ÍÓàÀ͹éÓ¢Øè¹">¡È¹.ÍÓàÀ͹éÓ¢Øè¹</option>
<option value="¡È¹.ÍÓàÀ͹éÓÂ×¹">¡È¹.ÍÓàÀ͹éÓÂ×¹</option>
<option value="¡È¹.ÍÓàÀͺس±ÃÔ¡">¡È¹.ÍÓàÀͺس±ÃÔ¡</option>
<option value="¡È¹.ÍÓàÀ;ԺÙÅÏ">¡È¹.ÍÓàÀ;ԺÙÅÏ</option>
<option value="¡È¹.ÍÓàÀÍ⾸Ôìä·Ã">¡È¹.ÍÓàÀÍ⾸Ôìä·Ã</option>
<option value="¡È¹.ÍÓàÀÍÁèǧÊÒÁÊÔº">¡È¹.ÍÓàÀÍÁèǧÊÒÁÊÔº</option>
<option value="¡È¹.ÍÓàÀÍÇÒÃÔ¹ªÓÃÒº">¡È¹.ÍÓàÀÍÇÒÃÔ¹ªÓÃÒº</option>
<option value="¡È¹.ÍÓàÀÍÈÃÕàÁ×ͧãËÁè">¡È¹.ÍÓàÀÍÈÃÕàÁ×ͧãËÁè</option>
<option value="¡È¹.ÍÓàÀÍÊÇèÒ§ÇÕÃÐǧ¤ì">¡È¹.ÍÓàÀÍÊÇèÒ§ÇÕÃÐǧ¤ì</option>
<option value="¡È¹.ÍÓàÀÍÊÓâç">¡È¹.ÍÓàÀÍÊÓâç</option>
<option value="¡È¹.ÍÓàÀÍÊÔÃÔ¹¸Ã">¡È¹.ÍÓàÀÍÊÔÃÔ¹¸Ã</option>
<option value="¡È¹.ÍÓàÀÍàËÅèÒàÊ×Íâ¡é¡">¡È¹.ÍÓàÀÍàËÅèÒàÊ×Íâ¡é¡</option>
<option value="Êӹѡ§Ò¹ ¡È¹.¨Ñ§ËÇÑ´ÍغÅÃÒª¸Ò¹Õ">Êӹѡ§Ò¹ ¡È¹.¨Ñ§ËÇÑ´ÍغÅÃÒª¸Ò¹Õ</option>
</select>
</div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> <font size="2">   Çѹ·Õèà¢éÒºÃèØ</font></td>
<td bgcolor="#FFFFFF"><font size="2">Çѹ·Õè
<select name="date3">
<option value=1 selected>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
<option value=8>8</option>
<option value=9>9</option>
<option value=10>10</option>
<option value=11>11</option>
<option value=12>12</option>
<option value=13>13</option>
<option value=14>14</option>
<option value=15>15</option>
<option value=16>16</option>
<option value=17>17</option>
<option value=18>18</option>
<option value=19>19</option>
<option value=20>20</option>
<option value=21>21</option>
<option value=22>22</option>
<option value=23>23</option>
<option value=24>24</option>
<option value=25>25</option>
<option value=26>26</option>
<option value=27>27</option>
<option value=28>28</option>
<option value=29>29</option>
<option value=30>30</option>
<option value=31>31</option>
</select>
à´×͹
<select name="month3">
<option value="1" selected>Á¡ÃÒ¤Á</option>
<option value=2>¡ØÁÀҾѹ¸ì</option>
<option value=3>ÁÕ¹Ò¤Á</option>
<option value=4>àÁÉÒ¹</option>
<option value=5>¾ÄÉÀÒ¤Á</option>
<option value=6>ÁԶعÒ¹</option>
<option value=7>¡Ã¡®Ò¤Á</option>
<option value=8>ÊÔ§ËÒ¤Á</option>
<option value=9>¡Ñ¹ÂÒ¹</option>
<option value=10>µØÅÒ¤Á</option>
<option value=11>¾ÄȨԡÒ¹</option>
<option value=12>¸Ñ¹ÇÒ¤Á</option>
</select>
¾.È.
<input name="year3" type="text" size="5" maxlength="5">
</font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><p><font size="2">
àÅ¢·Õèà§Ô¹à´×͹</font></p></td>
<td bgcolor="#FFFFFF">
<input name="num_salary" type="text" size="30" style="width: 100px" maxlength="100"></td>
</tr>
<tr bgcolor="#FFFFCC">
<td colspan="2">
<div align="center">
<input type="submit" name="Submit" value="Ê觢éÍÁÙÅ">
<input type="reset" name="Reset" value="ź¢éÍÁÙÅ">
</div></td>
</tr>
</table>
</form>
<?php include("footer.php")?>
</body>
</html>
ไฟล์ form.in.php
Code (PHP)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<title>:: Ãкº¢éÍÁÙźؤÅÒ¡ÃÍ͹äÅ·ì ::</title>
<style>
BODY {
FONT-FAMILY: Arial, Helvetica, sans-serif
}
</style>
</head>
<body >
<div align="center"><img src="images/nfe.png" width=100 height=100></div>
<center><font color="#0000CC" size="3">Ãкº¢éÍÁÙźؤÅÒ¡ÃÍ͹äÅ·ì<br>
Êӹѡ§Ò¹ ¡È¹.¨Ñ§ËÇÑ´ÍغÅÃÒª¸Ò¹Õ
</font></center>
<?php
include("connect.php"); // µéͧ·Ó¡Òà Include ä¿Åì·Õèà»ç¹¡ÒõÑ駤èÒ¡ÒõԴµèÍ°Ò¹¢éÍÁÙÅà¢éÒÁÒ´éÇÂ
$cid = $_POST['cid'];
$fn = $_POST['fn'];
$name = $_POST['name'];
$fname = $_POST['fname'];
$date = $_POST['date'];
$month = $_POST['month'];
$year = $_POST['year'];
$s_marry = $_POST['s_marry'];
$marryname = $_POST['marryname'];
$child = $_POST['child'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$mail = $_POST['mail'];
$degree = $_POST['degree'];
$major = $_POST['major'];
$institute = $_POST['institute'];
$date2 = $_POST['date2'];
$month2 = $_POST['month2'];
$year2 = $_POST['year2'];
$date3 = $_POST['date3'];
$month3 = $_POST['month3'];
$year3 = $_POST['year3'];
$dept = $_POST['dept'];
$position = $_POST['position'];
$num_salary = $_POST['num_salary'];
$result = mysql_query("insert into tb_name(name_id,cid,fn,name,fname,date,month,year,s_marry,marryname,child,address,phone,mail,degree,major,institute,date2,month2,year2,date3,month3,year3,dept,position,num_salary) values('','$cid','$fn','$name','$fname','$date','$month','$year','$s_marry','$marryname','$child','$address','$phone','$mail','$degree','$major','$institute','$date2','$month2','$year2','$date3','$month3','$year3','$dept','$position','$num_salary')");
if($result) {
echo "<center>à¾ÔèÁ¢éÍÁÙÅÊÓàÃç¨<br><br> <a href=\"showdata.php\">µ¡Å§</a> </center>";
}
else
{
echo "<center>à¾ÔèÁ¢éÍÁÙÅäÁèÊÓàÃç¨<br><br> <a href=\"form.php\">µ¡Å§</a> </center>";
}
?>
</body>
</html>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2011-08-17 16:29:20 |
By :
tossa |
View :
772 |
Reply :
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ควร เซต
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
เปน
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> ก่อนนะ
แล้วค่อยสร้างไฟล์
ลองสร้าง
Code (PHP)
$sql = "insert into tb_name(name_id,cid,fn,name,fname,date,month,year,s_marry,marryname,child,address,phone,mail,degree,major,institute,date2,month2,year2,date3,month3,year3,dept,position,num_salary) values('','$cid','$fn','$name','$fname','$date','$month','$year','$s_marry','$marryname','$child','$address','$phone','$mail','$degree','$major','$institute','$date2','$month2','$year2','$date3','$month3','$year3','$dept','$position','$num_salary')"
echo $sql ; มาดูก่อน
exit(); //ถ้าค่ามาครบค่อยบรรทัดนี้ทิ้ง
if (!mysql_query($sql)
{
die('Error: ' . mysql_error());
}
echo "เพิ่มเรียบร้อยแล้ว";
|
|
|
|
|
Date :
2011-08-17 16:45:33 |
By :
ckcr |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ยังไม่ได้ครับ
|
|
|
|
|
Date :
2011-08-17 18:27:57 |
By :
tossa |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Primary Key ซ้ำหรือเปล่าครับ ถึงเพิ่งได้แค่คนเดียวครับ
|
|
|
|
|
Date :
2011-08-17 21:14:41 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่ได้กำหนด Primary Key ให้เป็น Auto Increment หรือป่าวครับ เลยได้แค่อันเดว
|
|
|
|
|
Date :
2011-08-17 21:35:19 |
By :
slurpee55555 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ภาษาต่างดาวมาเชียว
|
|
|
|
|
Date :
2011-08-18 10:02:05 |
By :
sambrazil |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|