我有一个列表,在每行的末尾我有一个删除记录和一个戳记文件。我的代码适用于列表中的第一条记录,但不适用于任何其他行。是什么我失踪了。我将Javascript
和Ajax
与Buttons
一起使用。
$sql = "SELECT * FROM scanns WHERE `site` = '$csite' AND `date` BETWEEN '$sdate' AND '$edate' ";
$result_set=mysqli_query($link,$sql);
while($row=mysqli_fetch_array($result_set))
{
?>
<tr>
<td><?php echo $row['date']; ?></td>
<td><?php echo $row['site']; ?></td>
<td><?php echo $row['file_name']; ?></td>
<td><a href="scann/<?php echo $row['site']?>/<?php echo $row['file_name'] ?>" target="_blank">view scann</a></td>
<input id='date'type='hidden' value= "<?php echo $row['date']; ?>"/>
<input id='site'type='hidden' value= "<?php echo $row['site']; ?>"/>
<input id='filename' type='hidden' value= "<?php echo $row['file_name']; ?>"/>
<td><input id="submit" type="button" value="Delete Scan"></td>
<td><input id="stamp" type="button" value="Post File"></td>
</tr>
<?php
}
?>
</table>
这是完整的文件
<?php
require_once("../config.php");
$link = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$link) {
die('could not connect: ' .mysqli_error($link));
}
$db_selected = mysqli_select_db($link, DB_NAME);
if (!$db_selected) {
die('Car\'t use ' . DB_NAME . ': ' .mysqli_error($link));
}
$csite = $_POST['site'];
$sdate = $_POST['sdate'];
$edate = $_POST['edate'];
//var_dump($_POST);
?>
<!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>name</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<link href="css/refreshform.css" rel="stylesheet">
<script src="jvscripts/form.js"></script>
<link rel="stylesheet"href="Main_files/css3menu0/style.css" type="text/css" /><style type="text/css">._css3m{display:none}
<script>
</script>
</style>
</head>
<body>
<div class="container">
<div class="header"><a href="#"><img src="/images/logo1.png" alt="Insert Logo Here" name="Insert_logo" width="998" height="102" id="Insert_logo" style="background-color: #424542; display:block;" /></a>
<!-- end .header --></div>
<!-- Start css3menu.com BODY section -->
<div class="sidebar1">
<?php
include ('menu/menu.php');
?>
</div>
<div class="content">
<p style="text-align:center"><img src="cloudscan.png" width="100" height="60" alt="" align="middle" /></p>
<p><h3 style="width: 500px; margin-left: auto; margin-right: auto; text-align: center; color: black;">You have Selected the Store <?php echo $csite;?> </h3></p>
<p span style="background-color: #2C3539; color: #FFF;"font color: #FFFFFF>Listed Documents from date :<?php echo $sdate;?> to <?php echo $edate;?>.</p>
<table width="98%" border="1">
<tr>
<td>Date</td>
<td>Site</td>
<td>File</td>
<td>View</td>
<td>Delete</td>
<td>Post</td>
</tr>
<?php
$sql="SELECT * FROM scanns WHERE `site` = '$csite' AND `date` BETWEEN '$sdate' AND '$edate' ";
$result_set=mysqli_query($link,$sql);
while($row=mysqli_fetch_array($result_set))
{
?>
<tr>
<td><?php echo $row['date']; ?></td>
<td><?php echo $row['site']; ?></td>
<td><?php echo $row['file_name']; ?></td>
<td><a href="scann/<?php echo $row['site']?>/<?php echo $row['file_name'] ?>" target="_blank">view scann</a></td>
<td><input id='date' type='hidden' value= "<?php echo $row['date']; ?>"/><input id='site' type='hidden' value= "<?php echo $row['site']; ?>"/><input id='filename' type='hidden' value= "<?php echo $row['file_name']; ?>"/><input id="submit" type="button" value="Delete Scan"></td>
<td><input id="stamp" type="button" value="Post File"></td>
</tr>
<?php
}
?>
</table>
<button id="btnsubmit" onclick="goBack()">Change Site and date</button>
</div>
<script>
function goBack() {
window.location.href='cssites.php';
}
</script>
<div class="footer">
<p>"Successful people are always looking for opportunities to help others. Unsuccessful people are always asking, "What's in it for me?'' "</p>
<!-- end .footer --></div>
<!-- end .container --></div>
</body>
</html>