|
|
|
passing popup tp frmmain ....ส่งค่ารูปภาพจากการค้นหาข้อมูลไม่ได้ค้ะ |
|
|
|
|
|
|
|
ใส่ enctype="multipart/form-data" ในแทค <form> หรือยังคับ
http://www.pjgunner.com
|
|
|
|
|
Date :
2013-06-08 11:02:08 |
By :
pjgunner.com |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SET08.PHP
<script type="text/javascript">
function OpenDiv() {
var myWindow=window.open("search_division.php",'windowRef','width=1600,height=900');
if (!myWindow.opener) myWindow.opener = self;
}
function OpenEmp() {
var myWindow=window.open("search_emp.php",'windowRef','width=1600,height=900');
if (!myWindow.opener) myWindow.opener = self;
}
function PopDel() {
var myWindow=window.open("del08.php",'windowRef','width=1600,height=900');
if (!myWindow.opener) myWindow.opener = self;
}
</script>
<script language="JavaScript">
function showPreview(ele)
{
$('#imgAvatar').attr('src', ele.value); // for IE
if (ele.files && ele.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#imgAvatar').attr('src', e.target.result);
}
reader.readAsDataURL(ele.files[0]);
}
}
</script>
<?
$strSQL = "select * FROM employee ORDER BY emp_no DESC LIMIT 0,1";
$objQuery = mysql_query($strSQL)or die ("select error");
$objResult = mysql_fetch_array($objQuery);
$emp_no = $objResult["emp_no"];
$emp_no = substr($emp_no,4,3);
$emp_no = $emp_no+1;
$emp_no = sprintf("%03d",$emp_no);
$yy = date("Y");
$yy = substr($yy,2,2);
$mm = date("m");
$emp_no = $yy.$mm.$emp_no;
?>
<body bgcolor="#CCCCCC" >
<form action="save_set08.php" method="post" name="frmMain" enctype="multipart/form-data">
<table style="font-size:14px;border-bottom:2px dotted #999999;" width="100%" >
<tr>
<td><img src="image/user.png" width="35" height="35" /><b>เพิ่มข้อมูลพนักงาน</b></td>
</tr>
</table>
<br />
<fieldset style="border:1px solid #FFFFFF;">
<table width="698" align="center" class="ft">
<tr>
<td width="147" align="left">รหัสพนักงาน :</td>
<td width="253"><input type="text" id="emp_no" name="emp_no" class="txtbox1" value="<?=$emp_no;?>" readonly></td>
<td width="282" rowspan="2"><img id="imgAvatar" width='50' height='50' /></td>
</tr>
<tr>
<td>รูปภาพ :</td>
<td> <input type="file" name="filUpload" id="filUpload" OnChange="showPreview(this)">
<input name="FilesName" type="text" id="FilesName" >
</td>
</tr>
</table>
</fieldset>
<br>
<fieldset style="border:1px solid #FFFFFF;">
<legend style="font-size:13px; "><b>ข้อมูลพนักงาน</b></legend>
<table width="1233" align="left" class="ft">
<tr>
<td width="130">คำนำหน้า :</td>
<td width="244">
<select name="prefix" id="prefix" class="txtbox">
<option value="">-------------เลือก-------------</option>
<?
$strSQL = "SELECT * FROM prefix ORDER BY prefix_id ASC";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResuut["prefix_id"];?>" size="14"><?=$objResuut["prefix_name"];?></option>
<?
}
?>
</select>
</td>
<td width="168" align="left">ชื่อ :</td>
<td width="311"><input name="fname" type="text" id="fname" size="40" class="txtbox"></td>
<td width="112" align="left">นามสกุล :</td>
<td width="240"><input name="lname" type="text" id="lname" size="40" class="txtbox"></td>
</tr>
<tr>
<td width="130">คำนำหน้า (ENG) :</td>
<td>
<select name="pref_eng" id="pref_eng" class="txtbox">
<option value="">-------------เลือก-------------</option>
<?
$strSQL = "SELECT * FROM prefix_eng ORDER BY prefix_id ASC";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResuut["prefix_id"];?>" size="14"><?=$objResuut["prefix_name"];?></option>
<?
}
?>
</select>
</td>
<td align="left">ชื่อ (ENG) :</td>
<td><input name="fname_eng" type="text" id="fname_eng" onKeyUp="javascript:this.value=this.value.toUpperCase();" size="40" class="txtbox"></td>
<td align="left">นามสกุล (ENG) :</td>
<td><input name="lname_eng" type="text" id="lname_eng" onKeyUp="javascript:this.value=this.value.toUpperCase();" size="40" class="txtbox"></td>
</tr>
<tr>
<td>เบอร์โทรศัพท์ :</td>
<td><input type="text" name="tel" id="tel" class="txtbox"></td>
<td>เบอร์โทรศัพท์(มือถือ) :</td>
<td><input type="text" name="tel2" id="tel2" class="txtbox"></td>
<td>อีเมล์ :</td>
<td><input type="text" id="email" name="email" class="txtbox" value="@PAYOONMOTORS.COM" size="40"></td>
</tr>
<tr>
<td>วันเกิด :</td>
<td><input type="text" name="birth" id="birth" class="txtbox"></td>
<td>อายุ :</td>
<td><input type="text" id="age" name="age" class="txtbox" ><b>ปี</b></td>
<td>กรุ๊ปเลือด :</td>
<td>
<select name="blood" id="blood" class="txtbox">
<option value="">-------------เลือก-------------</option>
<option value="A">A</option>
<option value="AB">AB</option>
<option value="B">B</option>
<option value="O">O</option>
</select>
</td>
</tr>
</table>
</fieldset>
<button type="submit" value="บันทึก"><img src="image/save.png" />บันทึก</button>
</form>
SEARCH_EMP.php
<script language="javascript">
function selData(intLine,emp_no,prefix,fname,lname,pref_eng,fname_eng,lname_eng,tel,tel2,email,birth,age,blood,
address,nationality,nationality1,religion,idcard,issue_date,issue_at,start_work,div_no,stat_work,
guarantor,money,salary,FilesName)
{
var semp_no = self.opener.document.getElementById("emp_no" +intLine);
semp_no.value = emp_no;
var sprefix = self.opener.document.getElementById("prefix" +intLine);
sprefix.value = prefix;
var sfname = self.opener.document.getElementById("fname" +intLine);
sfname.value = fname;
var slname = self.opener.document.getElementById("lname" +intLine);
slname.value = lname;
var slname = self.opener.document.getElementById("lname" +intLine);
slname.value = lname;
var spref_eng = self.opener.document.getElementById("pref_eng" +intLine);
spref_eng.value = pref_eng;
var sfname_eng = self.opener.document.getElementById("fname_eng" +intLine);
sfname_eng.value = fname_eng;
var slname_eng = self.opener.document.getElementById("lname_eng" +intLine);
slname_eng.value = lname_eng;
var stel = self.opener.document.getElementById("tel" +intLine);
stel.value = tel;
var stel2 = self.opener.document.getElementById("tel2" +intLine);
stel2.value = tel2;
var semail = self.opener.document.getElementById("email" +intLine);
semail.value = email;
var sbirth = self.opener.document.getElementById("birth" +intLine);
sbirth.value = birth;
var sage = self.opener.document.getElementById("age" +intLine);
sage.value = age;
var sblood = self.opener.document.getElementById("blood" +intLine);
sblood.value = blood;
var saddress = self.opener.document.getElementById("address" +intLine);
saddress.value = address;
var snationality = self.opener.document.getElementById("nationality" +intLine);
snationality.value = nationality;
var snationality1 = self.opener.document.getElementById("nationality1" +intLine);
snationality1.value = nationality1;
var sreligion = self.opener.document.getElementById("religion" +intLine);
sreligion.value = religion;
var sidcard = self.opener.document.getElementById("idcard" +intLine);
sidcard.value = idcard;
var sissue_date = self.opener.document.getElementById("issue_date" +intLine);
sissue_date.value = issue_date;
var sissue_at = self.opener.document.getElementById("issue_at" +intLine);
sissue_at.value = issue_at;
var sstart_work = self.opener.document.getElementById("start_work" +intLine);
sstart_work.value = start_work;
var sdiv_no = self.opener.document.getElementById("div_no" +intLine);
sdiv_no.value = div_no;
var sstat_work = self.opener.document.getElementById("stat_work" +intLine);
sstat_work.value = stat_work;
var sguarantor = self.opener.document.getElementById("guarantor" +intLine);
sguarantor.value = guarantor;
var smoney = self.opener.document.getElementById("money" +intLine);
smoney.value = money;
var ssalary = self.opener.document.getElementById("salary" +intLine);
ssalary.value = salary;
var sFilesName = self.opener.document.getElementById("FilesName" +intLine);
sFilesName.value = FilesName;
window.close();
}
</script>
<form name="frmSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<fieldset>
<table align="left" style="font-size:15px" >
<tr>
<th align="center">ค้นหาจาก รหัส/ชื่อพนักงาน :</th>
<td>
<input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_GET["txtKeyword"];?>">
</td>
<td><button type="submit" name="Submit" value="Search" /><img src="image/search.png" width="18" height="18" /> ค้นหา</button></td>
<TD><button type="button" name="Submit" value="Search" onClick="JavaScript:window.close();"/><img src="image/exit.png" width="18" height="18"/>ปิดระบบ</TD></TD>
</tr>
</table>
</fieldset>
</form>
<fieldset>
<? $objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("motor");
$strSQL = "SELECT * FROM employee
WHERE emp_no LIKE '%".$_GET["txtKeyword"]."%' OR fname LIKE '%".$_GET["txtKeyword"]."%' OR lname LIKE '%".$_GET["txtKeyword"]."%'
ORDER BY emp_no";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table style="font-size:15px; font-family:Verdana, Geneva, sans-serif;">
<tr height="35" bgcolor="#CCCCCC">
<th width="161"> <div align="center">รหัสพนักงาน</div></th>
<th width="248"> <div align="center">ชื่อพนักงาน</div></th>
</tr>
<?
$i=1;
while($objResult = mysql_fetch_array($objQuery))
{
$birth = $objResult["birth"];
$issue_date = $objResult["issue_date"];
$start_work = $objResult["start_work"];
$salary = $objResult["salary"];
$money = $objResult["money"];
$salary = number_format($salary,'2','.',',');
$money = number_format($money,'2','.',',');
$issue_date = DateThai($issue_date);
$birth = DateThai($birth);
$start_work = DateThai($start_work);
if($i%2==0)
{
$bg = "#FFFFFF";
}
else
{
$bg = "#ebf0f0";
}
?>
<tr align="center" style="font-size:15px" bgcolor="<?=$bg;?>">
<td align="center"><a href="#" OnClick="selData('<?=$_GET["Line"];?>' ,
'<?=$objResult["emp_no"];?>', '<?=$objResult["prefix"];?>', '<?=$objResult["fname"];?>',
'<?=$objResult["lname"];?>', '<?=$objResult["pref_eng"];?>', '<?=$objResult["fname_eng"];?>',
'<?=$objResult["lname_eng"];?>', '<?=$objResult["tel"];?>', '<?=$objResult["tel2"];?>' ,
'<?=$objResult["email"];?>', '<?=$birth;?>' , '<?=$objResult["age"];?>',
'<?=$objResult["blood"];?>' , '<?=$objResult["address"];?>', '<?=$objResult["nationality"];?>' ,
'<?=$objResult["nationality1"];?>', '<?=$objResult["religion"];?>', '<?=$objResult["idcard"];?>' ,
'<?=$issue_date;?>' , '<?=$objResult["issue_at"];?>' , '<?=$start_work;?>' ,
'<?=$objResult["div_no"];?>' , '<?=$objResult["stat_work"];?>' , '<?=$objResult["guarantor"];?>',
'<?=$money;?>' , '<?=$salary;?>' , '<?=$objResult["FilesName"];?>' );">
<?=$objResult["emp_no"];?>
</a>
</td>
<td align="left"><?=$objResult["fname"];?> <?=$objResult["lname"];?></td>
</tr>
<?
}
?>
</table>
</fieldset>
|
ประวัติการแก้ไข 2013-06-08 11:06:26 2013-06-08 11:10:17
|
|
|
|
Date :
2013-06-08 11:03:14 |
By :
PALM26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขี้เกียจไล่โค้ด สรุป คืออัพโหลดรูป หรือส่งชื่อรูปไป วินโดวส์ใหม่ ถ้าส่งชื่อไฟล์ไปป้อปอัพ มันก็น่าจะขึ้นนะครับ ก็รูปอยู่บนโฮส
|
|
|
|
|
Date :
2013-06-08 11:11:00 |
By :
pjgunner.com |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้วทำไมต้องส่งค่าเยอะแยะไป หน้า set08 แค่ส่ง id ไปแล้วดึงจากฐานข้อมูลใหม่ไม่ดีเหรอคับ
|
|
|
|
|
Date :
2013-06-08 11:13:51 |
By :
pjgunner.com |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่ค่อยชำนาญเท่าไหร่ เดี่ยวจะลองดู
|
|
|
|
|
Date :
2013-06-08 11:42:33 |
By :
PALM26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|