|
|
|
รบกวนช่วยดู code ด้วยนะค่ะ เขียนเพิ่มข้อมูลแล้วเพิ่มไม่ได้ มะรุผิดตรงไหน(code ยาวหน่อยนะค่ะ) |
|
|
|
|
|
|
|
member.html
<HTML>
<HEAD>
<title>Member</title>
<META http-equiv=Content-Type CONTENT="text/html; charset=utf-8">
<link rel="StyleSheet" href="../lib/default.css" type="text/css" />
<link rel="StyleSheet" href="../lib/grid.css" type="text/css" />
<link rel="stylesheet" type="text/css" media="all" href="../lib/calendar-blue.css" title="winter" />
<SCRIPT type="text/javascript" src="../lib/calendar.js"></SCRIPT>
<SCRIPT type="text/javascript" src="../lib/calendar-th.js"></SCRIPT>
<script language="JavaScript" src="../lib/functions.js"></script>
<script language="JavaScript" src="../lib/validator.js"></script>
<SCRIPT LANGUAGE="JavaScript">
<!--
function ValidProfileForm(f) {
if (IsNull(f.fullname, "กรุณากรอก ชื่อ-สกุล")) return false;
if (IsNull(f.email, "กรุณากรอก อีเมล์")) return false;
if (IsInvalidEmail(f.email, "รูปแบบอีเมล์ไม่ถูกต้อง")) return false;
if (IsNull(f.phone, "กรุณากรอก เบอร์โทรศัพท์")) return false;
return true;
}
//-->
</SCRIPT>
</HEAD>
<BODY leftmargin="0" topmargin="0" bgproperties="fixed" marginwidth="0" marginheight="0">
<form name="form1" method="post" action="" onSubmit="return ValidProfileForm(this)">
<INPUT TYPE="hidden" name="action" value="SUBMIT">
<INPUT TYPE="hidden" name="id" value="VAR_ID">
VAR_HEADER_TBL
<TABLE width="75%" border="0" cellpadding="5" cellspacing="1" align="center">
<TR>
<TD>
<FIELDSET>
<table width="100%" border="0" cellspacing="1" cellpadding="3" class="default">
<tr align="center" height="22">
<td colspan="2">
<table width="100%" border="0" cellspacing="1" cellpadding="1" class="default">
<tr align="center" height="22">
<td align="left" width="3%"><a href="JavaScript:history.back()"><img src='../images/uptoroot.gif' alt='ย้อนกลับ' border='0'></a></td>
<td width="75%" align="left" style="color:blue;"><B>ข้อมูล Member</B></td>
<td align="right" style="color:blue;">VAR_ACTION</td>
</tr>
</table>
</td>
</tr>
<tr height="22">
<td width="25%" align="right" bgcolor="#D2E9FF" class="tfvNormal">ชื่อ-สกุล : </td>
<td bgcolor="#F5F5F5"><INPUT TYPE="text" NAME="fullname" VALUE="VAR_FULLNAME" size="100" maxlength="70"></td>
</tr>
<tr>
<td colspan="2" style="background-image:url('images/dot.gif'); color:blue; background-repeat:repeat-x;"><b>ที่อยู่ที่ทำงาน(Office Address)</b></td></tr>
<tr height="22">
<td width="25%" align="right" bgcolor="#D2E9FF" class="tfvNormal">อาชีพ : </td>
<td bgcolor="#F5F5F5"><INPUT TYPE="text" NAME="career" VALUE="VAR_CAREER" size="100" maxlength="70"> </td>
</tr>
<tr height="22">
<td width="25%" align="right" bgcolor="#D2E9FF" class="tfvNormal">บัตรประจำตัวประชาชน : </td>
<td bgcolor="#F5F5F5"><INPUT TYPE="text" NAME="card" VALUE="VAR_CARD" size="100" maxlength="13"> </td>
</tr>
<tr height="22">
<td width="25%" align="right" bgcolor="#D2E9FF" class="tfvNormal">ที่อยู่: </td>
<td bgcolor="#F5F5F5"><INPUT TYPE="text" NAME="address1" VALUE="VAR_ADDRESS1" size="100" maxlength="70"> </td>
</tr>
<tr height="22">
<td align="right" bgcolor="#D2E9FF" class="tfvNormal">เขต/อำเภอ : </td>
<td bgcolor="#F5F5F5"><input type="text" name="city1" value="VAR_CITY1" size="100" maxlength="50"> </td>
</tr>
<tr height="22">
<td align="right" bgcolor="#D2E9FF" class="tfvNormal">จังหวัด : </td>
<td bgcolor="#F5F5F5"><input type="text" name="province1" value="VAR_PROVINCE1" size="100" maxlength="50"> </td>
</tr>
<tr height="22">
<td align="right" bgcolor="#D2E9FF" class="tfvNormal">รหัสไปรษณีย์ : </td>
<td bgcolor="#F5F5F5"><input type="text" name="zipcode1" value="VAR_ZIPCODE1" size="100" maxlength="20"></td>
</tr>
<tr height="22">
<td align="right" bgcolor="#D2E9FF" class="tfvNormal">อีเมล์ : </td>
<td bgcolor="#F5F5F5"><INPUT TYPE="text" NAME="email" VALUE="VAR_EMAIL" size="100" maxlength="50"></td>
</tr>
<tr height="22">
<td align="right" bgcolor="#D2E9FF" class="tfvNormal">โทรศัพท์ : </td>
<td bgcolor="#F5F5F5"><INPUT TYPE="text" NAME="phone1" VALUE="VAR_PHONE1" size="100" maxlength="35"></td>
</tr>
<tr height="22">
<td align="right" bgcolor="#D2E9FF" class="tfvNormal">แฟกซ์ : </td>
<td bgcolor="#F5F5F5"><INPUT TYPE="text" NAME="fax" VALUE="VAR_FAX" size="100" maxlength="35"></td>
</tr>
<tr height="22">
<td align="right" bgcolor="#D2E9FF" class="tfvNormal"> </td>
<td bgcolor="#F5F5F5"><INPUT TYPE="submit" NAME="submit" VALUE="บันทึก" style="width:80px"> <INPUT TYPE="button" NAME="backbtn" VALUE="« ย้อนกลับ" style="width:80px" onClick="history.back()"></td>
</tr>
</table>
</FIELDSET>
VAR_FOOTER_TBL
</TD>
</TR>
</TABLE>
</form>
</BODY>
</HTML>
member.php
<?
session_start();
if (!session_is_registered("loginid")) header("location:index.php");
require("../header.lib.php");
$tpl = new FastTemplate('.');
$tpl->define(array(member => 'member.html'));
$tpl->assign(array(VAR_ID => $id));
$tpl->assign(array(VAR_LOGIN_NAME => $loginname));
DrawBackendHeader(3);
$lang = "th";
// Locations ...
$monthOption = NULL;
foreach ($MONTH[$lang] as $monthKey => $monthName) {
$monthOption .= "<option value='$monthKey'>".$monthName."</option>";
}
$tpl->assign(array(VAR_MONTH_OPTION => $monthOption));
// End of Locations ...
if (!empty($id)) {
$memberObj = GetRecord("member_tbl", "*", "id='$id'");
if ($memberObj->STATUS == "N") $tpl->assign(array(VAR_N_CHECKED => "checked"));
elseif ($memberObj->STATUS == "A") $tpl->assign(array(VAR_A_CHECKED => "checked"));
else $tpl->assign(array(VAR_D_CHECKED => "checked"));
$checked = ($memberObj->VIP == "Y") ? "checked" : NULL;
$tpl->assign(array(VAR_VIP_CHECKED => $checked));
$tpl->assign(array(VAR_CODE => htmlspecialchars(stripslashes($memberObj->CODE))));
$tpl->assign(array(VAR_FULLNAME => htmlspecialchars(stripslashes($memberObj->FULLNAME))));
$tpl->assign(array(VAR_CAREER => htmlspecialchars(stripslashes($memberObj->CAREER))));
$tpl->assign(array(VAR_CARD => htmlspecialchars(stripslashes($memberObj->CARD))));
$tpl->assign(array(VAR_ADDRESS1 => htmlspecialchars(stripslashes($memberObj->ADDRESS1))));
$tpl->assign(array(VAR_CITY1 => htmlspecialchars(stripslashes($memberObj->CITY1))));
$tpl->assign(array(VAR_PROVINCE1 => htmlspecialchars(stripslashes($memberObj->PROVINCE1))));
$tpl->assign(array(VAR_ZIPCODE1 => htmlspecialchars(stripslashes($memberObj->ZIPCODE1))));
$tpl->assign(array(VAR_EMAIL => htmlspecialchars(stripslashes($memberObj->EMAIL))));
$tpl->assign(array(VAR_PHONE1 => htmlspecialchars(stripslashes($memberObj->PHONE1))));
$tpl->assign(array(VAR_FAX => htmlspecialchars(stripslashes($memberObj->FAX))));
$tpl->assign(array(VAR_FULLNAME => htmlspecialchars(stripslashes($memberObj->FULLNAME))));
$tpl->assign(array(VAR_ADDRESS => htmlspecialchars(stripslashes($memberObj->ADDRESS))));
$tpl->assign(array(VAR_CITY => htmlspecialchars(stripslashes($memberObj->CITY))));
$tpl->assign(array(VAR_PROVINCE => htmlspecialchars(stripslashes($memberObj->PROVINCE))));
$tpl->assign(array(VAR_ZIPCODE1 => htmlspecialchars(stripslashes($memberObj->ZIPCODE1))));
$tpl->assign(array(VAR_PHONE => htmlspecialchars(stripslashes($memberObj->PHONE))));
$tpl->assign(array(VAR_NO_RESIDENTIAL => htmlspecialchars(stripslashes($memberObj->NO_RESIDENTIAL))));
$tpl->assign(array(VAR_NO_RETINUE => htmlspecialchars(stripslashes($memberObj->NO_RETINUE))));
$tpl->assign(array(VAR_NO_VEHICLES => htmlspecialchars(stripslashes($memberObj->NO_VEHICLES))));
$tpl->assign(array(VAR_ACTION => "แก้ไข"));
//$tpl->assign(array(VAR_EMAIL => htmlspecialchars(stripslashes($memberObj->EMAIL))));
//$tpl->assign(array(VAR_VIP_EMAIL => htmlspecialchars(stripslashes($memberObj->VIP_EMAIL))));
//$aBirthDate = explode("/", $memberObj->BIRTHDATE);
//$tpl->assign(array(VAR_SELECTED_BDAY => $aBirthDate[0]));
//$tpl->assign(array(VAR_SELECTED_BMONTH => $aBirthDate[1]));
//$tpl->assign(array(VAR_SELECTED_BYEAR => $aBirthDate[2]));
//$tpl->assign(array(VAR_COUNTRY => stripslashes($memberObj->COUNTRY)));
//$tpl->assign(array(VAR_ZIPCODE => htmlspecialchars(stripslashes($memberObj->ZIPCODE))));
}
else {
$tpl->assign(array(VAR_N_CHECKED => "checked"));
$tpl->assign(array(VAR_VIP_CHECKED => NULL));
$tpl->assign(array(VAR_CODE => NULL));
$tpl->assign(array(VAR_FULLNAME => NULL));
$tpl->assign(array(VAR_CAREER => NULL));
$tpl->assign(array(VAR_CARD => NULL));
$tpl->assign(array(VAR_ADDRESS1 => NULL));
$tpl->assign(array(VAR_CITY1 => NULL));
$tpl->assign(array(VAR_PROVINCE1 => NULL));
$tpl->assign(array(VAR_ZIPCODE1 => NULL));
$tpl->assign(array(VAR_EMAIL => NULL));
$tpl->assign(array(VAR_PHONE1 => NULL));
$tpl->assign(array(VAR_FAX => NULL));
$tpl->assign(array(VAR_FUllNAME => NULL));
$tpl->assign(array(VAR_ADDRESS => NULL));
$tpl->assign(array(VAR_CITY => NULL));
$tpl->assign(array(VAR_PROVINCE => NULL));
$tpl->assign(array(VAR_ZIPCODE1 => NULL));
//$tpl->assign(array(VAR_COUNTRY => "Thailand"));
$tpl->assign(array(VAR_PHONE => NULL));
$tpl->assign(array(VAR_NO_RESIDENTIAL => NULL));
$tpl->assign(array(VAR_NO_RETINUE => NULL));
$tpl->assign(array(VAR_NO_VEHICLES => NULL));
$tpl->assign(array(VAR_ACTION => "เพิ่ม"));
}
if ($action == "SUBMIT") {
if ($vip != "Y") $vip = "N";
$memberType = ($vip == "Y") ? "FBM" : "VIP";
$memberCode = $memberType.substr($code, 3);
if (!empty($id)) {
$memberid = $id;
# $fldSet = "status=?, code=?, fullname=?, email=?, vip_email=?, birthdate=?, address=?, city=?, province=?, country=?, zipcode=?, phone=?, fax=?, vip=?";
$fldSet = "fullname=?,career=?,card=?,address1=?,city1=?,province1=?,zipcode1=?,email=?,phone1=?,fax=?,fullname=?, address=?, city=?, province=?, zipcode1=?, phone=?, no_residential=?, no_retinue=?, no_vehicles=?";
// $data[] = $status;
// $data[] = $memberCode;
$data[] = $fullname;
$data[] = $career;
$data[] = $card;
$data[] = $address1;
$data[] = $city1;
$data[] = $province1;
$data[] = $zipcode1;
$data[] = $email;
$data[] = $phone1;
$data[] = $fax;
$data[] = $fullname;
// $data[] = $vip_email;
// $data[] = $bday."/".$bmonth."/".$byear;
$data[] = $address;
$data[] = $city;
$data[] = $province;
// $data[] = $country;
$data[] = $zipcode1;
$data[] = $phone;
$data[] = $no_residential;
$data[] = $no_retinue;
$data[] = $no_vehicles;
// $data[] = $vip;
UpdateRecord("member_tbl", $fldSet, "id='$id'", $data);
}
else {
$memberid = uniqid("");
# $fldList = "id, status, code, fullname, email, vip_email, birthdate, address, city, province, country, zipcode, phone, fax, loginname, password, registered_time";
$fldList = "id,fullname, career, card, address1, city1, province1, zipcode1, email, phone1, fax, fullname, address, city, province, zipcode1, phone, no_residential, no_retinue, novehicles, registered_time";
$data[] = $memberid;
// $data[] = $status;
// $data[] = $code;
$data[] = $fullname;
$data[] = $career;
$data[] = $card;
$data[] = $address1;
$data[] = $city1;
$data[] = $province1;
$data[] = $zipcode1;
$data[] = $email;
$data[] = $phone1;
$data[] = $fax;
$data[] = $fullname;
// $data[] = $vip_email;
// $data[] = $bday."/".$bmonth."/".$byear;
$data[] = $address;
$data[] = $city;
$data[] = $province;
// $data[] = $country;
$data[] = $zipcode1;
$data[] = $phone;
// $data[] = $loginname;
// $data[] = md5($password);
$data[] = date("Y-m-d H:i:s");
InsertRecord("member_tbl", $fldList, $data);
}
echo "<script>location.href='member_detail.php?id=$memberid';</script>";
}
DrawBackendFooter();
$tpl->parse(TEMPLATE, "member");
$tpl->FastPrint(TEMPLATE);
?>
[b][/b]
Tag : - - - -
|
|
|
|
|
|
Date :
2010-05-04 11:35:53 |
By :
wannisa_te |
View :
874 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้ว error มันฟ้องว่ายังไงละครับ ให้ดูโค้ดแบบนี้ คงตาลายแย่ ดูจาก error ง่ายกว่า
|
|
|
|
|
Date :
2010-05-04 11:45:46 |
By :
sivanut |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ก่อนอื่นต้องขอโทษทีนะค่ะที่ code ยาว อาจจะทำให้หลายคนตาลาย
มันไม่มีแจ้งerror อ่ะค่ะ
ก้อเลยไม่รุ้จะ post ยังไง เลยให้ดู code แบบform ทุกอย่างขึ้นปกติดี แต่เวลากด submit แล้วกลับไม่ส่งค่าที่กรอกลงในแบบฟอร์ม มาอะค่ะ เป็นค่าว่าง ๆ หมดเลย
|
|
|
|
|
Date :
2010-05-04 11:50:29 |
By :
wannisa_te |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอดูตัวโค้ด+ฐานข้อมูลหน่อยค่ะ จะได้เช็คให้ได้ถูกนะค่ะ ถ้าแบบที่คุณโพสมาดูยากมาก ตาลายค่ะ
ส่งมาบอกทางเมล์ก็ได้นะค่ะ เผื่อไม่ได้เข้าเว็บ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[b][/b]bgnhghdrhsdgnbbvgmjbhbbbbbbbbvgdfgsdfdgsdfhyjhgfghfgghfhgfgtghggfgfhgfhghghghgh
|
|
|
|
|
Date :
2011-10-13 16:07:53 |
By :
erfds |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|