|
|
|
คือว่าทำการเพิ่มข้อมูลจาก script แต่ว่าลบไม่ได้อ่ะคับ ช่วยดูให้หน่อยครับ |
|
|
|
|
|
|
|
คือว่าลบข้อมูลจาก script ไม่ได้อ่ะครับช่วยดูให้ที
Code (PHP)
<?php
require_once("_library/connect_db.php");
require_once("_library/functions.php");
?>
<?php
$myconnect = mysql_connect("localhost","root","1234");
if($myconnect){
}else{
echo "Not connect database";
}
$dbname = "db_carrent"; //ชื่อฐานข้อมูล
$tblname = "rent"; //ชื่อตาราง
@mysql_query('SET NAMES utf8');
mysql_select_db($dbname) or die("ติดต่อฐานข้อมูลไม่ได้");
if($rent_code <>""){
$sql = "select $tblname (rent_code,cus_code,rent_startdate,rent_enddate,total,quantity,revenue) values ('$rent_code', '$cus_code', '$rent_startdate', '$rent_enddate', '$total' ,'$quantity', '$revenue')";
$dbquery = mysql_db_query($dbname, $sql);
if(!$dbquery){
?>
<script type="text/javascript">
alert("ไม่สำเร็จ");
</script>
<?
}else{
?>
<script type="text/javascript">
alert("สำเร็จ");
</script>
<?
}
// ปิดการติดต่อฐานข้อมูล
mysql_close();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Artid Car Rent</title>
<meta name="Keywords" content="Free CSS Templates (Page 1 of 24), free templates, html css, web design" />
<meta name="Description" content="Free CSS Templates (Page 1 of 24), download website templates for your websites." />
<meta name="verify-v1" content="g2JHpPkAaMBxjkwxui0LwtNGDlfzoMpCbkFJhskAIYw=" />
<meta property="og:title" content="Free Templates (Page 1 of 24)" />
<meta property="og:image" content="http://www.templatemo.com/banners/templatemo_125x125_02.jpg" />
<meta property="og:site_name" content="Free CSS Templates" />
<meta property="og:description" content="Free CSS Templates (Page 1 of 24), Download Free Templates from templatemo.com" />
<link rel="stylesheet" type="text/css" href="../css/custom.css" /><!--call css custom.css-->
<link href="https://plus.google.com/111990605606998149242" rel="publisher" />
<script type="text/javascript" src="http://cdn.templatemo.com/swfobject.js"></script>
<link rel="shortcut icon" href="/favicon.ico" type="image/vnd.microsoft.icon" />
<script type="text/javascript">
window.google_analytics_uacct = "UA-732601-9";
</script>
</head>
<body>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div id="maincontainer">
<div id="top_section">
<div class="header_left">Free CSS Templates</div>
<div class="header_right">
<div align="right" style="margin: 0px 10px 10px 0px;">
</div>
</div>
</div>
<div class="line"></div>
<div id="mainmenu">
<ul class="glossymenu">
<li><a href="../login/emp_page.php"><b>หน้าหลัก</b></a></li>
<li class="current"> <!--class="current"--> <a href="add_driver.php"><b>เพิ่ม</b></a></li>
<li><a href="Frmdeleterent.php"><b>ลบ</b></a></li>
<li><a href="edit_rent.php"><b>แก้ไข</b></a></li>
<li ><a href="Frmsearchrent.php"><b>ค้นหา</b></a></li>
</ul>
</div>
<div style="clear: both; margin: 10px; height: 100%; text-align: center; "><!--body-->
<table align="center" border="0">
<tr>
<th ><p>เพิ่มรายการการเช่า</p></th>
<form name="form3" method="post" action="add_rent.php">
<table align="center" border="0">
<tr>
<td align="left">เลขที่ใบเช่า :</td>
<td align="left"><input name="rent_code" type="text" id="rent_code" /></td>
<td align="left">ชื่อลูกค้า :</td>
<td align="left"><input name="cus_code" type="text" id="cus_code" /></td>
</tr>
<tr>
<td align="left">กำหนดเช่า :</td>
<td align="left"><input name="rent_code" type="date" id="rent_datestart" /></td>
<td align="left">กำหนดคืน :</td>
<td align="left"><input name="cus_code" type="date" id="rent_dateend" /></td>
</tr>
<tr>
<td align="left">รหัสพนักงานขับรถ :</td>
<td align="left"><!--input name="rent_code" type="text" id="rent_code" /-->
<select id="emp_code">
<?
echo "<option value='ตัวแปร'>ตัวแปร</option>";
?>
</select>
</td>
<td align="left">หมายเลขรถ :</td>
<td align="left"><input name="cus_code" type="text" id="cus_code" /></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td align="right">
<input type="button" value="add" onclick="JavaScript:addrow(this);"/> <!---->
<input type="button" value="remove" onclick="JavaScript:remove(this);"/>
</td>
</tr>
</table>
</form>
<script type="text/javascript">
function addrow(value)
{
var row = document.createElement('tr'); // create row node
var col1 = document.createElement('td'); // create column node
var col2 = document.createElement('td'); // create second column node
var col3 = document.createElement('td');
var col4 = document.createElement('td');
var col5 = document.createElement('td');
var col6 = document.createElement('td');
var col7 = document.createElement('td');
var col8 = document.createElement('td');
var col9 = document.createElement('td');
row.appendChild(col1); // append first column to row
row.appendChild(col2); // append second column to row
row.appendChild(col3);
row.appendChild(col4);
row.appendChild(col5);
row.appendChild(col6);
row.appendChild(col7);
row.appendChild(col8);
row.appendChild(col9);
col1.innerHTML = document.getElementById('rent_code').value; // put data in first column
col2.innerHTML = document.getElementById('cus_code').value;
col3.innerHTML = "adf"/*document.getElementById('rent_datestart').value*/;
col4.innerHTML = "adf"/*document.getElementById('rent_dateend').value*/;
col5.innerHTML = "adf"/*document.getElementById('emp_code').value*/;
col6.innerHTML = document.getElementById('rent_datestart').value;
col7.innerHTML = document.getElementById('rent_dateend').value;
col8.innerHTML = document.getElementById('emp_code').value;
col9.innerHTML = '<input type="button" value="del" id="remove" onclick= remove('+ document.getElementById('cus_code').value +')/>';
/*'<input type="hidden" value="del" id ="remove"onclick="JavaScript:remove(this);">';*/
var table = document.getElementById("tableToModify"); // find table to append to
table.appendChild(row); // append row to table
}
function remove(id)
{
var d = document.getElementById(id);
var olddiv = document.getElementById('tableToModify');
d.parentNode.removeChild(olddiv);
}
</script>
</tr>
<tr>
<form name="from_list_rent" method ="post" action="add_rent.php">
<table align="center" border="0" id="tabshow">
<tr bgcolor="#CCCCCC">
<th>ชื่อพนักงานขับรถ</th>
<th>ทะเบียนรถ</th>
<th>ยี่ห้อ</th>
<th>รุ่น</th>
<th>เส้นทาง</th>
<th>กำหนดเช่า</th>
<th>กำหนดคืน</th>
<th>ราคาค่าเช่ารถ</th>
<th> </th>
</tr>
<? //เพิ่มส่วน ข้อมูลที่ add ?>
<div id="myDiv">
<tbody id="tableToModify">
<tr id="rowToClone">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</div>
<? //สิ้นสุดส่วนที่ add ข้อมูล ?>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><input type="submit" value ="Save"/></td>
<td><input type="reset" value ="Reset"/></td>
</tr>
</table>
</form>
</tr>
</table>
</div><!--end tag body-->
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-732601-9");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html>
Tag : HTML/CSS, JavaScript, Action Script, Ajax, jQuery
|
|
|
|
|
|
Date :
2012-12-07 18:26:23 |
By :
newstone |
View :
975 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|