|
|
|
พี่ครับมันขึ้นมาแบบนี้ มันแปลว่าอะไรหรอครับ คือมันบันทึกได้แค่ 1 table เองอะครับ |
|
|
|
|
|
|
|
กลัวรูปมันเล็กไปอะครับ ช่วยดูให้ทีนะครับ อยากรู้ว่ามัน error อะไรอะครับ ขอบคุณมากๆนะครับ
|
|
|
|
|
Date :
2012-05-06 13:51:11 |
By :
น้ำจัEฅu |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ส่วนนี้เป็นหน้าฟอร์มของผมนะครับ
Code
<body>
<form name="form" id="myform" method="post" action="save_regis.php" onSubmit="return rechk();">
<BR>
<table width="700" border="0">
<tr>
<td align="left"><legend><img src="images/regis.png" width="200" height="40"></td></legend>
</tr>
</table>
<table width="700" border="0" cellpadding="0" cellspacing="0">
<input name="au_member" type="hidden" id="au_member" value="1" >
<?php
include('connectdb.php');
$sql_show = "select ps_code from s_person ORDER BY ps_code DESC";
$result_show = mysql_query($sql_show) or die(mysql_error());
$row_show = mysql_fetch_array($result_show);
$id=$row_show['ps_code'];
$id = $id + 1;
$min = 6;
for($i=strlen($id); $i < $min; $i++){
$show_id = $show_id . 0;
}
$show_id = $show_id.$id;
?>
<td width="30%"> <input name="_ps_code" type="hidden" value="<?=$show_id?>" maxlength="6" /></td>
<?php
include('connectdb.php');
$sql_show1 = "select pm_code from s_permission ORDER BY pm_code DESC";
$result_show1 = mysql_query($sql_show1) or die(mysql_error());
$row_show1 = mysql_fetch_array($result_show1);
$id=$row_show1['pm_code'];
$id = $id + 1;
$min = 4;
for($i=strlen($id); $i < $min; $i++){
$show_id1 = $show_id1 . 0;
}
$show_id1 = $show_id1.$id;
?>
<td width="30%"> <input name="pm_code" type="hidden" value="<?=$show_id1?>" maxlength="6" /></td>
<tr>
<td width="30%"></td>
</tr>
<tr>
<td height="25"><div align="right">ชื่อเข้าใช้ระบบ :</div></td>
<td width="41%"> <input name ="username" id ="username" type ="text" maxlength ="20" style="width:130px" onChange="SubmitContent()" onBlur="chk_username()" />
<span class="style1"><font color="#FF0000">*</font></span></td>
<td width="29%" align="left"><span id="msg_user"></span><span id="msg_username"></span></td>
</tr>
<tr>
<td height="25"><div align="right">รหัสผ่าน :</div></td>
<td> <input name ="password" id ="password" type ="password" maxlength ="35" style="width:130px" onBlur="chkpass()"/>
<span class="style1"><font color="#FF0000">*</font></span></td>
<td align="left"><span id="msg_pass" ></span></td>
</tr>
<tr>
<td height="25"><div align="right">ยืนยันรหัสผ่าน :</div></td>
<td> <input name ="repassword" id ="RE_PASS" type ="password" maxlength ="35" style="width:130px" onBlur="CHK_RE_PASS()">
<span class="style1"><font color="#FF0000">*</font></span></td>
<td align="left"><span id="SHOW_RE_PASS"></span></td>
</tr>
<td height="25"><div align="right">คำนำหน้าชื่อ :</div></td>
<td>
<?
include('connectdb.php'); //ยืมข้อมูลจาก regis
$sql = mysql_query("select * from s_title"); //เลือกข้อมูลจากตารางประเภทสมาชิก
$total = mysql_num_rows($sql);?>
<select name="tl_code" id="tl_code" onBlur="chktitle()"/>
<? echo "<option>- กรุณาเลือก -</option>";
$i=0;
while ($i < $total)
{
$result = mysql_fetch_array($sql);
$tl_name = $result[tl_name];
$tl_code = $result[tl_code];
echo "<option value=\"$tl_code\"";
if("$tl_code"=="$row_show[tl_code]")
{
echo "selected" ;
}
echo ">$tl_name</option>";
$i++;
}
?>
</select> <span class="style1"><font color="#FF0000">*</font></span></td>
<td align="left"><span id="msg_title" class="text7" ></span></td>
</tr>
<tr>
<td height="25"><div align="right">ชื่อ :</div></td>
<td> <input type="text" name="ps_name" id="ps_name" maxlength="100" size="20" onBlur="chkname();"/>
<span class="style1"><font color="#FF0000">*</font></span></td>
<td align="left"><span id="msg_name" class="text7" ></span></td>
</tr>
<tr>
<td height="25"><div align="right">นามสกุล :</div></td>
<td> <input type="text" name="ps_surname" id="ps_surname" maxlength="100" size="20" onBlur="chksurname();" />
<span class="style1"><font color="#FF0000">*</font></span></td>
<td align="left"><span id="msg_surname" class="text7"></span></td>
</tr>
<tr>
<td height="25"><div align="right">เลขที่บ้าน :</div></td>
<td> <input type="text" name="ps_address" id="ps_address" maxlength="20" size="20" onblur="chkaddress()" onkeypress="return checkEventAdd(this)"/>
<span class="style1"><font color="#FF0000">*</font></span></td>
<td align="left"><span id="msg_address" class="text7"></span></td>
</tr>
<tr>
<td height="25"><div align="right">หมู่ :</div></td>
<td> <input type="text" name="ps_moo" id="ps_moo" maxlength="20" size="20" onBlur="chkmoo();" onkeypress="return checkEventMoo(this);"/></td>
<td align="left"><span id="msg_moo" class="text7"></span></td>
</tr>
<tr>
<td height="25"><div align="right">ถนน :</div></td>
<td> <input type="text" name="ps_road" id="ps_road" maxlength="100" size="20" onBlur="chkroad();" /></td>
<td align="left"><span id="msg_road" class="text7" ></span></td>
</tr>
<tr>
<td height="25"><div align="right">ตำบล/แขวง :</div></td>
<td> <select id="ddlDistrict" name="DISTRICT_ID" style="width:100px" onBlur="chkdistrict();">
</select>
<span class="style1"><font color="#FF0000">*</font></span> </td>
<td align="left"><span id="msg_district" class="text7" ></span></td>
</tr>
<tr>
<td height="25"><div align="right">อำเภอ/เขต :</div></td>
<td> <select id="ddlAmphur" name="AMPHUR_ID" style="width:100px" onChange = "ListDistrict(this.value);" onBlur="chkamphur();">
</select>
<span class="style1"><font color="#FF0000">*</font></span> </td>
<td align="left"><span id="msg_amphur" class="text7"></span></td>
</tr>
<tr>
<td height="25"><div align="right">จังหวัด :</div></td>
<td> <select id="ddlProvince" name="PROVINCE_CODE" style="width:100px" onChange ="ListAmphur(this.value);" onBlur="chkprovince();">
<option selected value=""></option>
<?
$strSQL = "SELECT * FROM province ORDER BY PROVINCE_ID ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResult = mysql_fetch_array($objQuery))
{
$PROVINCE_CODE=$objResult["PROVINCE_CODE"];
$PROVINCE_NAME=$objResult["PROVINCE_NAME"];
echo "<option value=\"$PROVINCE_CODE\"";
if($objResult["PROVINCE_CODE"]==$row_show["PROVINCE_CODE"]){
echo "selected";
}
echo ">$PROVINCE_NAME</option>";
}
?>
</select>
<span class="style1"><font color="#FF0000">*</font></span></td>
<TD align="left"> <span id="msg_province" class="text7" ></span></td>
</tr>
<tr>
<td height="25"><div align="right">รหัสไปรษณีย์ :</div></td>
<td> <INPUT TYPE="text" NAME="zipcode" id="zipcode" VALUE="<?=$row_show['zipcode']?>" MAXLENGTH="5" size="5" onBlur="chkzipcode();" onKeyPress="return checkEventZipcode(this);">
<span class="style1"><font color="#FF0000">*</font></span></td>
<td align="left"><span id="msg_zipcode" class="text7"></span></td>
</tr>
<tr>
<td height="26" valign="top"><div align="right">หมายเลขโทรศัพท์ : </div></td>
<td valign="top"> <input name="p1" type="text" class="fieldinput" id="p1" style="width: 20px; text-align: center;" onKeyUp="autotab(this, document.form.p2);" maxlength="1">
<input name="p2" type="text" class="fieldinput" id="p2" style="width: 20px; text-align: center;" onKeyUp="autotab(this, document.form.p3);" maxlength="1">
-
<input name="p3" type="text" class="fieldinput" id="p3" style="width: 20px; text-align: center;" onKeyUp="autotab(this, document.form.p4);" maxlength="1">
<input name="p4" type="text" class="fieldinput" id="p4" style="width: 20px; text-align: center;" onKeyUp="autotab(this, document.form.p5);" maxlength="1">
<input name="p5" type="text" class="fieldinput" id="p5" style="width: 20px; text-align: center;" onKeyUp="autotab(this, document.form.p6);" maxlength="1">
<input name="p6" type="text" class="fieldinput" id="p6" style="width: 20px; text-align: center;" onKeyUp="autotab(this, document.form.p7);" maxlength="1">
-
<input name="p7" type="text" class="fieldinput" id="p7" style="width: 20px; text-align: center;" onKeyUp="autotab(this, document.form.p8);" maxlength="1">
<input name="p8" type="text" class="fieldinput" id="p8" style="width: 20px; text-align: center;" onKeyUp="autotab(this, document.form.p9);" maxlength="1">
<input name="p9" type="text" class="fieldinput" id="p9" style="width: 20px; text-align: center;" onKeyUp="autotab(this, document.form.p10);" maxlength="1">
<input name="p10" type="text" class="fieldinput" id="p10" style="width: 20px; text-align: center;" maxlength="1">
<span class="style1"><font color="#FF0000">*</font></span></td>
</tr>
<tr>
<td height="25"><div align="right">อีเมล์ :</div></td>
<td> <input name ="ps_email" id ="ps_email" type ="text" maxlength ="100" size="25" onBlur="chkmail()"/><span class="style1"><font color="#FF0000"> *</font></span>
<td width="29%" align="left"><span id="msg_email" ></span></td>
</tr>
<?
function ranDomStr($length){
$str2ran = 'abcdefghijklmnopqrstuvwxyz0123456789';
$str_result = "";
while(strlen($str_result)<$length){
$str_result .= substr($str2ran,(rand()%strlen($str2ran)),1);
}
return($str_result);
}
$ran_str = randomstr(6);
?>
<TR valign="middle">
<TD height="25"></TD>
<TD height="25" align="left"> <img src="pic_text.php?str=<?=$ran_str?>"></TD>
</TR>
<TR>
<TD height="25"><div align="right">กรุณากรอก :</div></TD>
<TD align="left" height="25">
<input type="text" name="code_input" onBlur="checkFields()">
<input type="hidden" name="code_hidden" value="<?=$ran_str?>">
<TD align="left"><span id="msg_input" ></span></TD>
</td>
</TR>
<tr>
<td>
</td>
<td><input type="submit" name="submit" value="สมัครสมาชิก" onclick="return rechk();" class="botton"/> <input type="reset" name="reset" value="reset" ></td>
</tr>
</table>
</form>
</body>
ส่วนอันนี้จะเป็นหน้า save นะครับ
Code
<?php
session_start();
$idcard1=$_POST['p1'];
$idcard2=$_POST['p2'];
$idcard3=$_POST['p3'];
$idcard4=$_POST['p4'];
$idcard5=$_POST['p5'];
$idcard6=$_POST['p6'];
$idcard7=$_POST['p7'];
$idcard8=$_POST['p8'];
$idcard9=$_POST['p9'];
$idcard10=$_POST['p10'];
$ps_tel = "$idcard1$idcard2-$idcard3$idcard4$idcard5$idcard6-$idcard7$idcard8$idcard9$idcard10";
?>
<HTML>
<HEAD>
<TITLE>ระบบการให้บริการหลังการขายออนไลน์</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" type="image/x-icon" href="images/computer.ico">
</HEAD>
<BODY>
<?php
include('connectdb.php');
{
echo $sql="insert into s_person(
ps_code,
tl_code,
ps_name,
ps_surname,
ps_address,
ps_moo,
ps_road,
PROVINCE_CODE,
AMPHUR_ID,
DISTRICT_ID,
ps_tel,
ps_email,
zipcode)
values (
'$_ps_code',
'$tl_code',
'$ps_name',
'$ps_surname',
'$ps_address',
'$ps_moo',
'$ps_road',
'$PROVINCE_CODE',
'$AMPHUR_ID',
'$DISTRICT_ID',
'$ps_tel',
'$ps_email',
'$zipcode')";
$result=mysql_db_query($database,$sql);
$pw=md5($_POST['repassword']);
echo $sql_user = "insert into s_user(
username,
password,
ps_code,
ug_code,
user_status,
login_status)
values(
'$username',
'$pw',
'$_ps_code',
'08',
'0',
'0')";
echo $sql_per = "insert into s_permission(
pm_code,
username,
au_member)
values(
'$pm_code',
'$username',
'1')";
$result=mysql_db_query($database,$sql_per);
if(mysql_db_query($database,$sql_user))
{
$date_time=date("Y-m-d H:i:s");
$user=$_SESSION["ss_user_name"];
$ip=$_SERVER['REMOTE_ADDR'];
$action="สมัครสมาชิก : $_ps_code : $username";
$sql_log="insert into logfile(no,date_time,user,ip,action)values('$on','$date_time','$user','$ip','$action')";
echo "<script language='javascript'>alert(' บันทึกข้อมูลเรียบร้อยแล้ว! ');</script> ";
echo "<meta http-equiv='refresh' content='0 ;url=index.php'>";
}
else
{
echo "<br><BR>";
// echo "<script language='javascript'>alert(' การบันทึกข้อมูลล้มเหลว ! ');history.back();</script> ";
}
}
if(mysql_db_query($database,$sql_log)or mysql_db_query($database,$sql_log1))
{
echo "<meta http-equiv='refresh' content='0 ;url=index.php'>";
}
?>
</BODY>
</HTML>
|
|
|
|
|
Date :
2012-05-06 14:26:25 |
By :
น้ำจัEฅu |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แปลกน่ะครับ ดูแล้วก็ไม่มีอะไรผิด Syntax
|
|
|
|
|
Date :
2012-05-06 17:27:19 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|