我正在尝试在“retrieve.php”中创建一个视图按钮,该按钮的功能可以点击“查看”按钮,用户可以在HTML页面中看到他们的信息。 “名字”,“姓氏”,“地址”等信息将显示在HTML页面中。我在点击“查看”时使用了主键,但如何将“查看”按钮链接到HTML页面?我将不胜感激任何帮助。
retrieve.php
<?php
echo "<body style='background-color:#87CEEB'>";
include ("account.php");
( $dbh = mysql_connect( $hostname, $username, $password ))
or die ( "unable to connect to MYSQL database" );
mysql_select_db( $project );
if (isset($_POST['search'])) {
$sql= "SELECT * FROM BPi_registration ";
$search_term = mysql_real_escape_string($_POST['search_box']);
$sql .= "WHERE first_name= '{$search_term}'";
$sql .= " OR last_name= '{$search_term}'";
$query=mysql_query($sql) or die(mysql_error());
}
?>
<html>
<head>
<title>Jon</title>
</head>
<body>
<form name="search_form" method="POST" action="retrieve.php">
<table width="599" border="1">
<tr>
<th>Search Here
<input type ="text" name ="search_box" value=""/>
<input type="submit" name="search" value="Find Users">
</tr>
</table>
</form>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">First Name </div></th>
<th width="98"> <div align="center">Last Name </div></th>
<th width="198"> <div align="center">Email </div></th>
<th width="97"> <div align="center">City </div></th>
<th width="97"> <div align="center">State </div></th>
<th width="59"> <div align="center">Country </div></th>
<th width="59"> <div align="center">View </div></th>
<tr>
<?php if (isset($_POST['search'])) {
while ($row=mysql_fetch_array($query)){ ?>
<tr>
<td><?php echo $row['first_name'];?></td>
<td><?php echo $row['last_name'];?></td>
<td><?php echo $row['email'];?></td>
<td><?php echo $row['address_city'];?></td>
<td><?php echo $row['address_state'];?></td>
<td><?php echo $row['address_country'];?></td>
<td><a href="handler.php?id=<?php echo $row['id'] ?>">View </a><td>
<tr>
<?php }} ?>
</table>
Coach.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="stylus.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js">
</script>
<script src="function.js"></script>
<meta name="" content="">
</head>
<body>
<div class="heading">
<div id="logo">
</div>
<div id="setting">
<a href="#">Settings</a>
<a href="#">Logout</a>
</div>
</div>
<div class="tabs">
<ul class="tab-links">
<li class="active"><a href="#tab1">Profile</a></li>
<li><a href="#tab2">Team</a></li>
<li><a href="#tab3">Playbook</a></li>
</ul>
<div class="tab-content">
<div id="tab1" class="tab active">
<div class="pic">
<img src="0248t.jpg">
</div>
<div class="profile-container">
<div id="bar"><b><h3>Profile Information</h3></b></div>
<div class="profile"></div>
</div>
<div class="bio-container">
<div id="bar"><b><h3>Bio</h3></b></div>
<div class="bio"></div>
</div>
</div>
<div id="tab2" class="tab">
<p>Tab #2 content goes here!</p>
<p>Donec pulvinar neque sed semper lacinia. Curabitur lacinia ullamcorper nibh; quis imperdiet velit eleifend ac. Donec blandit mauris eget aliquet lacinia! Donec pulvinar massa interdum risus ornare mollis. In hac habitasse platea dictumst. Ut euismod tempus hendrerit. Morbi ut adipiscing nisi. Etiam rutrum sodales gravida! Aliquam tellus orci, iaculis vel.</p>
</div>
<div id="tab3" class="tab">
<p>Tab #3 content goes here!</p>
<p>Donec pulvinar neque sed semper lacinia. Curabitur lacinia ullamcorper nibh; quis imperdiet velit eleifend ac. Donec blandit mauris eget aliquet lacinia! Donec pulvinar massa interdum ri.</p>
</div>
</div>
</div>
</body>
</html>
答案 0 :(得分:0)
这对于codeigniter ......
<td><?php $str="<button type='button' class='btn btn-success'>Delete</button>";echo anchor("/Student/Student_Delete/".$k['sid'],$str);?></td>
您可以将此用于查看页面...
<td><a href="handler.php?id=<?php echo $row['id'] ?>"><input type="button" value="view"/> </a><td>