how to make my records clickable? for example the names of my records..so that when i click them i will be redirected to a new page where i can print that record and its other info.. here's where my table looks like
<div id="vi">
<div id = "search_field">
<?php
$search_field = array('name'=>"search_field",'placeholder'=>"Search booking : Type the name of guest.");
echo form_open('site/view');
echo form_input($search_field);
echo form_submit('search',"Search");
?>
</div>
<?php
$this->table->set_heading("Name","Nationality","Contact Number","Number of Guest","Date of Arrival","Package","Other Request","Delete Record","Edit");
$qry = $this->db->like('name',$search_key)->get('booking');
if ($qry->num_rows > 0) {
foreach ($qry->result() as $row) {
$this->table->add_row($row->name,$row->nationality,$row->contactnum,$row->number_of_guest,$row->date,$row->package,$row->request,anchor('site/delete/'.$row->id, 'Delete'),anchor('site/update/'.$row->id, 'Edit'));
}
}
else{
echo "No records found!";
}
echo $this->table->generate();
Try this one
<?php
$this->table->add_row("<a href='yourpage.php?name=$name' target='_blank'>$row->name
</a>",$row->nationality,$row->contactnum,$row->number_of_guest,
$row->date,$row->package,$row->request,anchor('site/delete/'.$row->id,
'Delete'),anchor('site/update/'.$row->id, 'Edit'));
?>
If the datas comes form you DB , you'll do something like that :
<?php
$query = "SELECT ..... FROM....";
$res = mysql_query($query);
// HEADER
$this->table->set_heading("Name","Nationality","Contact Number","Number of Guest","Date of Arrival","Package","Other Request","Delete Record","Edit");
while($res=mysql_fetch_array($res)){
$id = mysql_fetch_array("id");
$name = mysql_fetch_array("name");
$nationnality = mysql_fetch_array("nationnality");
$guests = mysql_fetch_array("guests");
$date = mysql_fetch_array("date");
//...
$this->table->add_row("<a href='secondPage.php?id=$id'>".$name."<a>",$nationnality,$guests,$date);
}
?>
you query get infos in the db, and for each result you create a new line.
then , you need a link with something to identify your line from the others , so each line have a different id .
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.