简体   繁体   中英

Create a view button in PHP and link it to HTML page

I am trying to create a view button in "retrieve.php" that would function in such a way that on-click of "view" button, the user would see their information in HTML page. The information such as "First Name", "Last Name", "Address" are going to be displayed in HTML page. I have used primary key on click of "view" but how do i link "view" button to HTML page? I would appreciate any help.

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> 

this for codeigniter...

<td><?php $str="<button type='button' class='btn btn-success'>Delete</button>";echo anchor("/Student/Student_Delete/".$k['sid'],$str);?></td>

you can used This for view page ...

<td><a href="handler.php?id=<?php echo $row['id'] ?>"><input type="button" value="view"/> </a><td>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM