Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ดูโค๊ดให้ทีครับ แอดข้อมูลลง DB ไม่ได้ ตอนแอดไม่ได้คับ แต่ลบ กับแก้ไขได้ครับ



 

ดูโค๊ดให้ทีครับ แอดข้อมูลลง DB ไม่ได้ ตอนแอดไม่ได้คับ แต่ลบ กับแก้ไขได้ครับ

 



Topic : 032923



โพสกระทู้ ( 7 )
บทความ ( 0 )



สถานะออฟไลน์




ตอนแอดไม่ได้คับ แต่ลบ กับแก้ไขได้ครับ

add form
<html>
<head>
<title>No title</title>
<meta name="generator" content="Namo WebEditor">
<link rel="stylesheet" href="stylesheet/template_css.css" type="text/css" />
<title>:: test ::</title>
<link rel="stylesheet" href="./css/popcalendar.css" type="text/css" />
<script language='javascript' src='popcalendar.js'></script>
<script language="JavaScript">
   //****************************** Function ตรวจสอบข้อมูลใน TextBox ******************************
    function SetFocus(form){
      form.emp_name.focus(); return;
    }
    function dosubmit(){                             
        window.document.frm.submit()
    }
    function CheckData(form)
   {
         if (form.per_user.value == "")
        { alert("กรุณากรอกข้อมูลชื่อเข้าใช้งานด้วยครับ!"); form.per_user.focus(); return; }
         else if (form.per_password.value == "")
        { alert("กรุณากรอกข้อมูลรหัสผ่านด้วยครับ!"); form.per_password.focus(); return; }
         else if (form.per_name.value == "")
        { alert("กรุณากรอกข้อมูลชื่อผู้ใช้งานด้วยครับ!"); form.per_name.focus(); return; }
         else if (form.per_lastname.value == "")
        { alert("กรุณากรอกข้อมูลนามสกุลด้วยครับ!"); form.per_lastname.focus(); return; }
        else if (form.per_nickname.value == "")
        { alert("กรุณากรอกข้อมูลชื่อเล่นด้วยครับ!"); form.per_nickname.focus(); return; }
        else if (form.per_idcard.value == "")
        { alert("กรุณากรอกข้อมูลหมายเลขบัตรประชาชนด้วยครับ!"); form.per_idcard.focus(); return; }
        else if (form.per_address.value == "")
        { alert("กรุณากรอกข้อมูลที่อยู่ด้วยครับ!"); form.per_address.focus(); return; }
        else if (form.per_phone.value == "")
        { alert("กรุณากรอกข้อมูลหมายเลขโทรศัพท์ด้วยครับ!"); form.per_phone.focus(); return; }
        else if (form.position_id.value == "")
        { alert("กรุณากรอกข้อมูลตำแหน่งงานด้วยครับ!"); form.position_id.focus(); return; }
        else{
        if(con=confirm("คุณต้องการเพิ่มข้อมูลในครั้งนี้ ! ใช่หรือไม่ ?")){
              form.submit();}
        else{
        return ;
     }
     
   }
}
   var chk_data = (navigator.appName=="Netscape")?1:0;

   //***************************** End Function ***************************************************//
 function check_number() {
    e_k=event.keyCode
//if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
    if (e_k != 13 && (e_k < 48) || (e_k > 57)) {
        event.returnValue = false;
        alert("ต้องกรอกข้อมูลเป็นตัวเลขเท่านั้น");
        }
}
</script>

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<? 
         include_once("../class/connect.php");
         include_once("../class/class_person.php");
         include_once("../class/position.php"); 
        $oper = new person();   
        $oposition = new position();
        $oper->SelectPerson();    
?>

<form method="post" name="form1"action="padd_per.php" enctype="multipart/form-data">
<table border="1" width="911" height="464">
    <tr>
        <td width="180" height="458">
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
      </td>
        <td width="715" height="458">
            <table border="1" width="713" height="522">
                <tr>
                    <td colspan="4">ยินดีต้อนรับ</td>
                </tr>
                <tr>
                    <td height="56" colspan="4">
                        <p align="center">เพิ่มข้อมูลเจ้าของกิจการ</p>
                  </td>
                </tr>
                <tr>
                    <td width="170" height="13">&nbsp;</td>
                    <td width="221" height="13">หมายเลขเจ้าของกิจการ</td>
                    <td width="378" height="13" colspan="2"><input type="hidden" name="per_id" value="<? echo $oper->GetNextCode(); ?>" readonly /><strong> <? echo $oper->GetNextCode(); ?></td>
                </tr>
                <tr>
                    <td width="170" height="13">&nbsp;</td>
                    <td width="221" height="13">ชื่อเข้าใช้งาน</td>
                    <td width="378" height="13" colspan="2"><input type="text" name="per_user" class="textbox"></td>
                </tr>
                <tr>
                    <td width="170" height="6">&nbsp;</td>
                    <td width="221" height="6">รหัสผ่าน</td>
                    <td width="378" height="6" colspan="2"><input type="text" name="per_password" class="textbox"></td>
                </tr>
                <tr>
                    <td width="170" height="7">&nbsp;</td>
                    <td width="221" height="7">ชื่อ</td>
                    <td width="378" height="7" colspan="2"><input type="text" name="per_name" class="textbox"></td>
                </tr>
                <tr>
                    <td width="170" height="11">&nbsp;</td>
                    <td width="221" height="11">สกุล</td>
                    <td width="378" height="11" colspan="2"><input type="text" name="per_lastname" class="textbox"></td>
                </tr>
                <tr>
                    <td width="170" height="14">&nbsp;</td>
                    <td width="221" height="14">ชื่อเล่น</td>
                    <td width="378" height="14" colspan="2"><input type="text" name="per_nickname" class="textbox"></td>
                </tr>
                <tr>
                    <td width="170" height="11">&nbsp;</td>
                    <td width="221" height="11">เพศ</td>
                    <td width="378" height="11">
                    <input type=radio checked="" value="1" name=gender>ชาย
                  <input type=radio value="2" name=gender> หญิง</td>    
                </tr>
                <tr>
                    <td width="170" height="20">&nbsp;</td>
                    <td width="221" height="20">หมายเลขบัตรประชาชน</td>
                    <td width="378" height="20" colspan="2"><input type="text" name="per_idcard"  maxlength="13" onKeypress="check_number();" class="textbox"></td>
                </tr>
                <tr>
                    <td width="170" height="23">&nbsp;</td>
                    <td width="221" height="23">ที่อยู่</td>
                    <td width="378" height="50" colspan="2" rowspan="2"><label>
                      <textarea name="per_address" ></textarea>
                    </label></td>
                </tr>
                  <tr>
                    <td width="170" height="14">&nbsp;</td>
                    <td width="221" height="14">&nbsp;</td>
                </tr>
                <tr>                                                                                 
                    <td width="170" height="17">&nbsp;</td>
                    <td width="221" height="17">หมายเลขโทรศัพท์</td>
                    <td width="378" height="17" colspan="2"><input type="text" name="per_phone"  maxlength="10" onKeypress="check_number();" class="textbox"></td>
                </tr>
                <tr>
                    <td width="170" height="29">&nbsp;</td>
                    <td width="221" height="29">ตำแหน่งงาน</td>
                    <td width="378" height="29" colspan="2"><select name="position_id" >
                      <option value="">-เลือกตำแหน่ง-</option>
                      <?
                               $oposition->showposition();
                               while($oposition->GetRecord()){
                     ?>
                      <option value="<?=$oposition->position_id?>"><?echo $oposition->position_name?></option>
                      <?}?>
                  </select></td>
                </tr>
                <tr>
                    <td height="12" colspan="2">
                  
                      <div align="right">
                        <input type="button" value="  บันทึก  " onClick="CheckData(form1)" style="cursor:hand" title="เพิ่มข้อมูล" border="1" />                     
                        </div></td>
                    <td width="378" height="12" colspan="2"><input type="reset" value="ล้างข้อมูล"  name="reset"></td>
                </tr>
          </table>
      </td>
    </tr>
</table>
</form>
<p>&nbsp;</p>
</body>
</html> 



process
 <?php 
    session_start();

        include("../class/connect.php");
        include("../class/class_person.php");    
        include("../class/position.php");
        
        $oper = new person();
        $oposition = new position();        
?>

<html>
<head>
<title>:: อาคารที่พักอาศัยรวม วิไลรุ่งเจริญเพลส ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<link rel="stylesheet" href="stylesheet/template_css.css" type="text/css" />
<style type="text/css"></style>
</head>

<body>


<table width="912" border="1" align="center" cellpadding="0" cellspacing="0"  bgColor="#ffffff" valign="top" >
  <tr>
    <td width="201" valign="top"><br>
        
        
</td>
<td width=180" rowspan="3">
<table width="88%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
        <tr> 
            <td width="69%" valign="top"><br>&nbsp; <font size="2" face="MS Sans Serif, Tahoma, sans-serif"> <center>
     <?
                       $oper->Addnew();
                        $oper->per_id =$oper->GetNextCode();
                        $oper->per_user = $per_user;
                        $oper->per_password = $per_password;        
                        $oper->per_name =  $per_name;    
                        $oper->per_lastname =  $per_lastname;
                        $oper->per_nickname = $per_nickname;
                        $oper->per_gender = $per_gender;
                        $oper->per_idcard = $per_idcard;
                        $oper->per_address = $per_address;
                        $oper->per_phone = $per_phone;
                        $oper->per_status  = $per_status ;
                        $oper->position_id = $position_id;
                        $oper->Save();  
                                              
        echo"<br><br>";
        echo"<table  width=60% align=center cellpadding=5  cellspacing=5 b>";
        echo"<tr >
                    <td width=50% valign=top >
                        <table border=0 width=100% >
                            <tr><td><font color=#0033CC size=2 face=MS Sans Serif, Tahoma, sans-serif><center><b>ระบบทำการบันทึกข้อมูลแล้วครับ !</b></center></font>
                            </td>
                            </tr>
                        </table>
                    </tr>";
    echo"</table>";
    echo"<meta http-equiv='refresh' content='1; URL=manage_owner.php'>";  
        $oper->Destroy();
?></center>
      </font></td>
  </tr>
</table>
</td>
</body>
</html>




Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2009-10-11 20:57:57 By : zadaharu View : 642 Reply : 2
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ลองไปดูที่ $oper->Save(); ครับ






Date : 2009-10-11 21:05:03 By : webmaster
 


 

No. 2



โพสกระทู้ ( 7 )
บทความ ( 0 )



สถานะออฟไลน์


save ไม่มีปัญหานะคับ เพราะว่า ผมใช้กับ edit ด้วย
Date : 2009-10-11 21:53:07 By : zadaharu
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ดูโค๊ดให้ทีครับ แอดข้อมูลลง DB ไม่ได้ ตอนแอดไม่ได้คับ แต่ลบ กับแก้ไขได้ครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่