选择已从MYSQL中提取的数据

时间:2013-03-15 00:32:35

标签: php mysql

如果标题不清楚我很抱歉,我真的不知道这会是什么类型的标题。我将从我正在开展的工作开始。我正在尝试帮助我的公司存储数据并将它们从一个非常大的ex​​cel文件中拉出来。我有一个网页,使用PHP显示来自MYSQL的数据并放入表中。我将它设置为您可以更新和删除用户信息的位置。我现在需要做的是,他们需要从他们看到的列表中打印选定的几个人。所以我认为已经提取的数据我可以有一个带有复选框的表单,以便他们选择要发送到另一个页面的用户进行打印。我在想我选择

echo $rows['id']; 

是为该用户发布的。我似乎无法找到如何获取已发布的ID。我看到我是如何通过

来更新用户的
<td align="center"><a href="update.php?id=<?php echo $rows['id']; ?>"><font color="Blue">Update</font></a></td>

但这只是选择那个用户。这是我正在使用的代码。

<?php
$host="localhost"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=""; // Database name
$tbl_name=""; // Table name

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT * FROM $tbl_name ORDER BY lname";
$result=mysql_query($sql);


?>










<html>
<head>
<link rel="stylesheet" type="text/css" href="mysite.css">


</head>

<body>

<div id="title">
<center>
<img src="Logo.jpg" />
</center>

<p class="intitle"><font size="3"><a href="form.html" title="Add New Client"><font     color="blue">New Client</font></a></p>
</div>



<br />
<br />




<center>



<table width="600" border="1" cellspacing="0" >
<th>Print</th>
<th>                    <strong>PRG</strong>        </th>
<th class="name">       <strong>NAME</strong>       </th>
<th class="sex">        <strong>SEX</strong>        </th>
<th>                    <strong>PHASE</strong>      </th>
<th>                    <strong>DOCKET</strong>     </th>
<th class="date">       <strong>INTAKE</strong>     </th>
<th class="address">    <strong>ADDRESS</strong>    </th>
<th class="phone">      <strong>PHONE</strong>      </th>
<th class="phone">      <strong>ALT PHONE</strong>  </th>
<th class="date">       <strong>LAST OV</strong>    </th>
<th class="date">       <strong>LAST HV</strong>    </th>
<th class="date2">      <strong>OV</strong>         </th>
<th class="date2">      <strong>HV</strong>         </th>
<th>                    <strong>UPDATE</strong>     </th>
<th>                    <strong>DELETE</strong>     </th>




<?php
while($rows=mysql_fetch_array($result)){
?>
<form id="sendtoprint" class="appnitro"  method="post" action="printview.php">
<tr>
<td align="center" >        <input type="checkbox" id="" name="id"    value="printview.php?id=<?php echo $rows['id']; ?>" ></td>
<td align="center">         <?php echo $rows['program'];     ?>                  </td>
<td align="center">         <?php echo $rows['lname']; ?>,         <?php echo $rows['fname']; ?>    </td>
<td align="center">         <?php echo $rows['sex']; ?>         </td>
<td align="center">         <?php echo $rows['phase']; ?>       </td>
<td align="center">         <?php echo $rows['docket']; ?>      </td>
<td align="center">         <?php echo $rows['intake']; ?>      </td>
<td align="center">         <?php echo $rows['address']; ?>     </td>
<td align="center">         <?php echo $rows['phone']; ?>       </td>
<td align="center">         <?php echo $rows['altphone']; ?>    </td>
<td align="center">         <?php echo $rows['lastov']; ?>      </td>
<td align="center">         <?php echo $rows['lasthv']; ?>      </td>
<td align="center">         <?php echo $rows['hv']; ?>          </td>
<td align="center">         <?php echo $rows['ov']; ?>          </td>
<td align="center"><a href="update.php?id=<?php echo $rows['id']; ?>"><font color="Blue">Update</font></a></td>
<td align="center"><a href="delete_ac.php?id=<?php echo $rows['id']; ?>"><font color="Blue">Delete</font></a></td>
</tr>



<?php
}
?>

</table>
<input style='position:relative; left:-630px; top: -200px;' id="saveForm"  class="button_text" type="submit" name="submit" value="Print Selected" />
</form>
</center>
<?php
mysql_close();
?>

这是显示信息的页面。现在我需要一个带有复选框的表单,让他们选择要发送到其他页面的用户进行打印。

有没有办法让它工作,或者这比我想做的更复杂。

如果你可以提供帮助那就太棒了

由于

阿德里安

0 个答案:

没有答案