Black Holed Request Cakephp - javascript

On my index page I have check boxes in each row of my table.
To edit selected items, I use javascript/jquery to grab the class of the checkboxes, build an array of the ids and then post it to the edit selected method in my controller.
Now, this all works perfectly, but when Security in enabled in my App Controller, my post gets black holed and the array is not posted.
Here is my index.ctp file:
<table id="indexTable">
<thead><tr>
<th> <?php echo $this->Form->checkbox('select_all', array('value' => 'select_all')); ?> </th>
<th> <?php echo $this->Paginator->sort('id', 'ID'); ?> </th>
<th> <?php echo $this->Paginator->sort('name', 'Name'); ?> </th>
<th>Auto Offset </th> <th>UTC Offset Sec </th> <th>In Month </th>
<th>In Week </th> <th>In Dow </th> <th>In Hour </th> <th>Out Month </th>
<th>Out Week </th> <th>Out Dow </th> <th>Out Hour </th> <th>Offset Sec </th>
<th>DST Ref </th> <th>Actions </th>
</tr></thead>
<tbody>
<?php
$this->Form->create('LocalClock');
foreach($localClocks as $LocalClock) { ?>
<tr>
<td> <?php echo $this->Form->checkbox('LocalClocks'.$LocalClock['LocalClock']['id'], array('value' => $LocalClock['LocalClock']['id'], 'hiddenField' => false));?> </td>
<td> <?php echo $LocalClock['LocalClock']['id']; ?> </td>
<td> <?php echo $LocalClock['LocalClock']['name']; ?> </td>
<td> <?php echo $LocalClock['LocalClock']['auto_offset']; ?> </td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<!-- This <div> contains all the actions that can be performed on the Local Clocks. -->
<div>
<p>
<span style="float: left">
<?php echo $this->Html->link(__('Edit All Items'), array('action' => 'editAll'), array('class' => 'link'));?>
</span>
<span style="float: left">
<?php echo $this->Html->link(__('Edit Selected Items'), array('action' => 'lceditSelected'), array('class' => 'general_dialog'));?>
</span>
<span style="float: right">
<?php echo $this->Html->link(__('Delete Selected Items'), array('action' => 'deleteSelected'), array('class' => 'general_dialog'));?>
</span>
<?php $this->Form->end(); ?>
</p>
</div>
I took out some unimportant stuff. The problem is with my edit selected and delete selected functions.
Here is the javascript code that waits for their click and then builds the array to post to the controller action:
$('.general_dialog').live('click', function()
{
$.ajaxSetup({ async: false });
var $selDialog = $("#general_dialog").dialog(
{
autoOpen: false,
modal: true,
});
var postInfo = $('#LocalClockIndexForm').serialize();
$.ajax({
url: $(this).attr('href'),
type: "post",
data: postInfo,
success: function (response)
{
alert('success');
},
error: function()
{
alert("failed");
}
});
$selDialog.load($(this).attr('href'), function ()
{
$selDialog.dialog('open');
});
return false; // Ensure the controller does not redirect to the actual edit page
});
Any help on how to get it to work without getting black holed would be greatly appreciated.
Thanks in advance
------------------------------------------EDIT----------------------------------------------
I added $this->Form->create('LocalClock') and $this->Form->end() to the table and I switched the $.post() to and $.ajax() call.
If I send the serialised form, I don't get a black hole, but when I look at the data posted, it does not include any of the check box ids.

Your example lacks form tags.
You need to create and end the form with the Form helper to ensure that the security token is included in the form generation:
$this->Form->create();
// Other form elements here.
$this->Form->end();

Have you tried to modify crsf protection policy?
If you reload the page with the same token, the Security component will black hole the request.
var $components = array('Security'=>array('csrfUseOnce'=>false));

Related

How to update the database using a checkbox in a table column?

I am new to PHP and just began to learn JS as it is required at this phase of the project. I have a database named- asms
table named - filtersms
column named - filter_op . In this column of the table I have a checkbox for each row and my requirement is to enter 'yes' to the filter_op column once I check the checkbox and remains 'no' if not checked. I tried to do this using PHP itself but happens to be impossible to update the table on the click of the checkbox. As I am a beginner to JS can you please help me to get through this.
This is how filtersms table looks like,
|id |vendor |alarm_name |filter_op|
|1 |HUAWEI | communication fault |no |
|2 |HUAWEI | STP link fault |no |
|3 |ZTE | Battery discharge |no |
|4 |ZTE | AC power off |no |
Following is the PHP code I written so far to add a checkbox to each row and display the table.
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Page Heading -->
<h1 class="h2 mb-2 text-gray-800">Filter SMS</h1>
<!-- DataTales Example -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h4 class="m-0 font-weight-bold text-primary">Filtered SMS Summary</h4>
</div>
<div class="card-body">
<?php
//Table select query for database
require('include/connection.php');
$query1="SELECT* FROM filtersms ";
$result_set=mysqli_query($connection,$query1);
// require('include/filtercheck.php');
?>
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>Vendor</th>
<th>Alarm</th>
<th>Filter Option</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Vendor</th>
<th>Alarm</th>
<th>Filter Option</th>
</tr>
</tfoot>
<tbody>
<?php
while($row=mysqli_fetch_assoc($result_set)) {
?>
<tr>
<td><?php echo $row["vendor"]; ?></td>
<td><?php echo $row["alarm_name"]; ?></td>
<td>
<form action="include/filtercheck.php" method="POST">
<div class="form-check">
<input type="checkbox" class="form-check-input" value="yes" name="filter_check" id="filter_check"/>
<label class="form-check-label" for="filter_check">Filter Alarm</label>
</div>
</form>
</td>
</tr>
<?php
}
?>
You can use jQuery.post() for it.
For each row, use:
<tr>
<td><?php echo $row["vendor"]; ?></td>
<td><?php echo $row["alarm_name"]; ?></td>
<td>
<input type="checkbox" value="2" class="js-checkbox-filter" <?php echo ($row["filter_op"] == "yes" ? "checked" : NULL) ?> />
</td>
</tr>
These checkbox are now identified by the js-checkbox-filter class, and you can use it to bind a jQuery.change() event handler on it.
var checks = $(".js-checkbox-filter")
checks.change(function() {
$.post("filtercheck.php", {
id: this.value,
filtered: this.checked ? "yes" : "no"
})
})
You'll have to change your filtercheck.php file too. It must receive an id and filtered ("yes"/"no") parameters through $_POST variable. Use them to update your database table.
You can try something like this if I understand your question correctly. That uses jQuery so you need to include the CDN script. That basically submits data via AJAX indicating the new filter options for the row checked or unchecked. It does that my posting an array as filter_op_post having index 0 = to true or false and index 1 equal to the id of the row in the database. You can process that in the filtercheck.php file, although I included a little snippet. Let me know if that works for you.
That AJAX response is in "data", so you can return whatever you want and process that as needed.
POST:
filter_op_post[] […]
0 true
1 2
RESPONSE:
["true","2"] e.g.
index.php page:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous">
</script>
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Page Heading -->
<h1 class="h2 mb-2 text-gray-800">
Filter SMS
</h1>
<!-- DataTales Example -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h4 class="m-0 font-weight-bold text-primary">
Filtered SMS Summary
</h4>
</div>
<div class="card-body">
<?php
$Config = array(
'DB_TYPE' => 'mysql',
'DB_HOST' => '127.0.0.1',
'DB_NAME' => 'alarmfilter',
'DB_USER' => 'root',
'DB_PASS' => 'root',
'DB_PORT' => '3306',
'DB_CHARSET' => 'utf8'
);
$options = array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ, PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING, PDO::ATTR_EMULATE_PREPARES => true );
try {
$database = new PDO($Config['DB_TYPE'] . ':host=' . $Config['DB_HOST'] . ';dbname=' . $Config['DB_NAME'] . ';port=' . $Config['DB_PORT'] . ';charset=' . $Config['DB_CHARSET'], $Config['DB_USER'], $Config['DB_PASS'], $options);
}
catch (PDOException $e) {
// Echo custom message. Echo error code gives you some info.
echo 'Database connection can not be estabilished. Please try again later.' . '<br>';
echo 'Error code: ' . $e->getCode();
// Stop application :(
// No connection, reached limit connections etc. so no point to keep it running
exit;
}
$query="SELECT* FROM filtersms ";
$parameters = [];
$stmt = $database->prepare($query);
$stmt->execute($parameters);
$result_set = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>Vendor</th>
<th>Alarm</th>
<th>Filter Option</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Vendor</th>
<th>Alarm</th>
<th>Filter Option</th>
</tr>
</tfoot>
<tbody>
<?php
foreach ($result_set as $row) {
?>
<tr>
<td><?php echo $row["vendor"]; ?>
</td>
<td><?php echo $row["alarm_name"]; ?>
</td>
<td>
<form>
<div class="form-check">
<?php $checked = ($row["filter_op"] == "true")?"checked":""; ?>
<input
<?php echo $checked; ?>
type="checkbox" class="form-check-input filter_check" id ="filter_op_id
<?php echo $row["id"]; ?>
"/>
<input type="hidden" name="filter_op_post[]" value="<?php echo $row[" filter_op"]; ?>
"/>
<input type="hidden" name="filter_op_post[]" value="<?php echo $row[" id"]; ?>
"/> <label class="form-check-label" for="filter_check">Filter Alarm</label>
</div>
</form>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<style> table, table tr, table td {
border:black 1px solid;
border-collapse: collapse;
</style>
<script>
$(".filter_check").on("click", function(e) {
$(this).next().val($(this).prop("checked"));
formdata = $(this).closest("form").serialize();
$.ajax({
type: "POST",
url: 'include/filtercheck.php',
dataType: "json",
data: formdata,
beforeSend: function(e) {
// $("#spinner").css("display", "block");
},
})
.done(function(data, textStatus, jqXHR) {
alert(data);
})
.fail(function( jqXHR, textStatus, errorThrown) {
})
.always(function(jqXHR, textStatus) {
$("#spinner").css("display", "none");
});
});
</script>
include/filtercheck.php page:
<?php
$rowid = $_POST['filter_op_post'][1];
$filter_op_value = $_POST['filter_op_post'][0];
echo json_encode($_POST['filter_op_post']);
?>
You could use a form with a submit button.
<form method="POST">
<input type="checkbox" class="form-check-input" value="true" name="filter_check" id="filter_check"/>
<label class="form-check-label" for="filter_check">
<button type="submit" name"submit" value="Submit">Submit</button>
</form>
With this you could update the database using the Post method
if(isset($_POST['submit']))
{
/* update database here
/* your value of the checkbox is &_POST['filter_check']
}

How update records in the database and remove a table row on button click using ajax?

So I have created an HTML table with dynamic rows. On the end the every row there is a button. When that button on the particular row is clicked, the row needs to removed without page refresh.
So I'm trying to do it by changing the values of column in database on button click. There is a field named 'status' in my database, which is initially set to 'unchecked'. But when I click the button, the update query is to be triggered hence changing the 'status' field to 'checked' on that particular row, and removing that particular.
newCust.php
<table class="table table-bordered table-striped table-light table-
responsive text-nowrap">
<thead class="thead-dark">
<tr>
<th class="col"><label> nID</label></th>
<th class="col"><label> CUSTOMER NAME </label></th>
<th class="col"><label> ADDRESS </label></th>
<th class="col"><label> CITY </label></th>
<th class="col"><label> STATUS </label></th>
</tr>
</thead>
<tbody>
<?php
<!-- GETTING DATA FROM THE TABLE WHERE STATUS FIELD IS UNCHECKED -->
$query = "select * from mx_newcustomer where status = 'unchecked'";
$result = mysqli_query($db,$query);
while($res = mysqli_fetch_array($result)){
$nID = $res['nID'];
?>
<tr>
<td><?php echo $nID; ?></td>
<td><?php echo $res['customername']; ?></td>
<td><?php echo $res['address']; ?></td>
<td><?php echo $res['city']; ?></td>
<td><button type="button" id="button<?php echo $nID; ?>" class="btn btn-
dark" >Ok</button></td>
</tr>
<script>
<!-- AJAX TO UPDATE RECORDS IN THE DATABASE-->
$(document).ready(function () {
$("#button<?php echo $nID ?>").click(function(){
alert('Test');
jQuery.ajax({
type: "POST",
url: "updateCust.php",
<--TRYING TO
PASS THE CLICKED BUTTON ID. I BELIEVE THIS IS WHAT I'M DOING WRONG-->
data: {"nID":$('#button<?php echo $nID ?>').serialize()},
success: function(response)
{
alert("Record successfully updated");
}
});
});
});
</script>
updateCust.php
$db = mysqli_connect("credentials");
$nID = $_POST['nID'];
$query = "UPDATE mx_newcustomer SET status = 'checked' WHERE nID =
'$nID'";
$res = mysqli_query($db, $query);
error_reporting(E_ALL);
ini_set('display_errors','On');
I'm not getting any errors, but the update query is not being triggered either. The expected result is remove the table row whose button has been clicked, without the page being refreshed.
Don't use .serialize(), it returns a string in the form name=value. But your button doesn't have a name or value, so there's nothing to serialize.
Change it to:
data: {"nID": <?php echo $nID ?>},
To delete the row, you can use:
success: function() {
$("#button<?php echo $nID?>").closest("tr").remove();
}

Popup content dependent on AJAX result

I am not that experienced in web developing, so sorry for rookie mistakes;)
In HTML, I want to create a dynamic popup window(div hidden by CSS). On the click of a button I am performing an AJAX post request. The result of the request is a string, which is stored in a hidden input field on the HTML page.
The popup contains a table with the content submitted by the string.
However now I want to retrieve the string via a PHP $_GET or $_POST request.
This is not working at the moment and I don't understand why.
Opening the popup window I am getting these errors:
Notice: Undefined index: popupcontenthidden in ...
Warning: Invalid argument supplied for foreach() in
The HTML:
<div class="popupcontent">
<span class="helper"></span>
<div>
<div class="popupclose">X</div>
<h3>UPDATE DATABASE ENTRY</h3>
<h4>Enter values:</h4>
<table id="popupresult">
<form name='form' action="" method='post'>
<input type='text' name='popupcontenthidden' id='popupcontenthidden'>
</form>
<tr>
<th>Field</th>
<th>Type</th>
<th>Null</th>
<th>Key</th>
<th>Default</th>
<th>Extra</th>
<th>Value</th>
</tr>
<?php
$rows = json_decode($_POST['popupcontenthidden']);
foreach ( $rows as $print ) {
?>
<tr>
<td><?php echo $print->Field; ?></td>
<td><?php echo $print->Type; ?></td>
<td><?php echo $print->Null; ?></td>
<td><?php echo $print->Key; ?></td>
<td><?php echo $print->Default; ?></td>
<td><?php echo $print->Extra; ?></td>
</tr>
<?php } ?>
</table>
</div>
The JS:
$.ajax({
type:'POST',
url: '../wp-content/plugins/ars-management/admin/ars-management-admin-ajax.php',
data: {function: "update", entries: entries},
success: function(response) {
var rows = response;
//hand data to html hidden input
document.getElementById("popupcontenthidden").value = rows;
//open popup on click
$(".popupcontent").show();
}
});
I understand that the second error is happening because $rows is empty.
But how can I fix the issue and retrieve the string from the input field? I can confirm that the string is correctly stored in the input field so all the AJAX stuff works.
Thank you so much!
A kind of solution here:
HTML:
<div class="popupcontent">
<span class="helper"></span>
<div class="popupclose">X</div>
<h3>UPDATE DATABASE ENTRY</h3>
<h4>Enter values:</h4>
<table id="popupresult">
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Null</th>
<th>Key</th>
<th>Default</th>
<th>Extra</th>
<th>Value</th>
</tr>
</thead>
<tbody id="myPopupContentTableBody"></tbody>
</table>
</div>
Javascript:
$.ajax({
type:'POST',
url: '../wp-content/plugins/ars-management/admin/ars-management-admin-ajax.php',
data: {function: "update", entries: entries},
success: function(response) {
$('#myPopupContentTableBody').html(response);
//open popup on click
$(".popupcontent").show();
}
});
PHP:
<?php
...
$rows = myPHPCalculation;
foreach ($rows as $print){
echo '
<tr>
<td>'.$print['Field'].'</td>
<td>'.$print['Type'].'</td>
<td>'.$print['Null'].'</td>
<td>'.$print['Key'].'</td>
<td>'.$print['Default'].'</td>
<td>'.$print['Extra'].'</td>
</tr>
';
}
...

How to add checkbox for each row in table html with php embedded and update its value in database(Postgresql)?

I have already fetch the record from the database. It is shown on the html table. But it is still Non editable mode. I want to make sure the record shown is completely okay and update its Boolean value in the database. Otherwise it should be shown as red in color which are not approved i.e they are incorrect.
May be this can be easy. But please help me working this out. Sharing my code.
<div class="login-signup-head">Edit Table</div>
<table>
<tbody>
<thead>
<tr class="tredit">
<!-- <th width="10"></th> -->
<th contenteditable="true"> Id </th>
<th contenteditable="true"> University Id </th>
<th contenteditable="true"> Name </th>
<th contenteditable="true"> College Id </th>
<th width="100"> </th>
</tr>
</thead>
<tbody>
<?php
foreach($student_data as $row){
?>
<tr class="tredit">
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['university_id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['college_id']; ?></td>
<td><input type='button' class='editable' onclick="table_edit()" value='Edit'/>
<input type='button' class='tabledelete' onclick="table_update()" value='Delete'></td>
</tr>
<?php
}
?>
</div>
</div>
</div>
<!-- </form> -->
</div>
</div>
</tbody>
</table>
This above code is called with the help of function in controller class whose code is below:
public function tableedit(){
if($this->session->userdata('university_id')){
/*if($this->input->server("REQUEST_METHOD") === "POST"){*/
// $data['user_id'] = $this->session->userdata('university_id');
/*$data['name'] = $this->input->post('college_name');
$data['college_id'] =$this->input->post('college_id');
$insert = $this->home_model->addCollege($data);
$data['success'] = 'college added successfully';
}*/
$user_id = $this->session->userdata('university_id');
$data['user_id'] = $user_id;
$data['student_data'] = $this->home_model->table_data($user_id);
$this->load->view('home/new-header',$data);
// $data['get_social'] = $this->home_model->get_social();*/
// $this->load->view('socail', $data);
// if (isset($_POST['id'])) {
// echo json_encode($response);
// }
/*$this->home_model->update_university_password($user_id,$password);*/
$this->load->view('home/left_university_sidebar',$data);
$this->load->view('edit_table',$data);
$this->load->view('home/footer');
} else {
$data['error'] = 'Table Cannot be viewed!';
$this->load->view('home/header');
$this->load->view('edit_table');
$this->load->view('home/footer');
}
}
Now this above code is getting called in the model class i.e where the queries are called.
public function table_data($user_id) {
$this->db->select('id,university_id,name,college_id');
/*$this->db->where('university_id',trim($user_id));*/
$this->db->from('college');
$query = $this->db->get();
return $query->result_array();
/* $query = $this->db->query("SELECT id,university_id,name,college_id FROM college");
$this->db->where('user_id',$university_id);
return $query->result_array();*/
}
It is a strange question in all fairness and we cannot code it for you.
But in your view, you need to make your table inside a form, then add a table cell to contain your checkbox.
How you generate your checkbox is up to you, you can use the CI form_helper or you can just code bootstrap checkbox, or use a plain html checkbox. The value of your checkbox you can set like this:
<input type="checkbox" name="my_value[]" value="<?php echo $entry_id; ?>">
Where entry id is your row id or identifier you set. You collect your input something like this
$my_data = $this->input->post('my_value');
You now have an array of all your checked values. Run through these and do whatever you want.
As for showing items in red that do not fit a particular criteria, a simple if statement in your view will do that, either displaying an entirely different piece of HTML or setting a class to use on the row, table cell or text.
I hope this helps in some way, but your question was rather vague to begin with.
Good luck with your website,
Best wishes,
Paul.

Echo PHP Variable to Button Value Then Send Button Value to Input text

Hello I am wanting to echo a PHP Variable to a buttons value then send the buttons value to an input text. I was able to echo the button with the variable but when I click the button it does nothing. I'm not sure why, because when I do this without the PHP just the script, and inputs it works perfectly. I am just missing something I know it, I can't find much info on how to pass php to a button then pass the button value to an input text.
Here's the script that passes the button value to the input text:
$( document ).ready(function() {
var $theButtons = $(".button");
var $theinput = $("#theinput");
$theButtons.click(function() {
$theinput.val(this.value);
});
});
Here's the PHP that echos the variable as a button:
require "config.php"; // database connection
$in=$_GET['txt'];
if(!ctype_alnum($in)){ //
echo "Search By Name, or Entry ID";
exit;
}
$msg="";
$msg="";
if(strlen($in)>0 and strlen($in) <20 ){
$sql="select name, entry, displayid from item_template where name like '%$in%' LIMIT 10"; // the query
foreach ($dbo->query($sql) as $nt) {
//$msg.=$nt[name]."->$nt[id]<br>";
$msg .="<table style='table-layout:fixed;'> // Just the start of my table
<tr>
<td>Name</td>
<td>Entry ID</td>
<td>Display ID</td>
</tr>
<tr>
<td align=center><a href=http://wowhead.com/item=$nt[entry]>
$nt[name]</a>
</td>
<td>$nt[entry]</td>
<td>
<input type=button class=button value=$nt[displayid]> // The Value I need echoed out in a button is $nt[displayid]
</td>
</tr>
</table>"; // end of my table}
}
$msg .='';
echo $msg;
Not that it matters but here is the input text
<input type="text" id="theinput"/>
Make it easy on yourself and try to make your code easy to read. I personally prefer to write my html cleanly and outside of echo statements like so:
Html
if (strlen($in) > 0 and strlen($in) < 20) {
$sql = "select name, entry, displayid from item_template where name like '%{$in}%' LIMIT 10"; // the query
foreach ($dbo->query($sql) as $nt) {
//$msg.=$nt[name]."->$nt[id]<br>";
?>
<table style="table-layout:fixed;">
<tr>
<td>Name</td>
<td>Entry ID</td>
<td>Display ID</td>
</tr>
<tr>
<td align="center">
<?=$nt['name'];?>
</td>
<td><?=$nt['entry'];?></td>
<td>
<input type="button" class="button" value="<?=$nt['displayid'];?>">
</td>
</tr>
</table>
<?php
}
}
Javascript
$( document ).ready(function() {
var $theButtons = $(".button");
var $theinput = $("#theinput");
$theButtons.click(function() {
// $theinput is out of scope here unless you make it a global (remove 'var')
// Okay, not out of scope, but I feel it is confusing unless you're using this specific selector more than once or twice.
$("#theinput").val(jQuery(this).val());
});
});
Ok, here goes...
Use event delegation in your JavaScript to handle the button clicks. This will work for all present and future buttons
jQuery(function($) {
var $theInput = $('#theinput');
$(document).on('click', '.button', function() {
$theInput.val(this.value);
});
});
Less important but I have no idea why you're producing a complete table for each record. I'd structure it like this...
// snip
if (strlen($in)>0 and strlen($in) <20 ) :
// you really should be using a prepared statement
$sql="select name, entry, displayid from item_template where name like '%$in%' LIMIT 10";
?>
<table style="table-layout:fixed;">
<thead>
<tr>
<th>Name</th>
<th>Entry ID</th>
<th>Display ID</th>
</tr>
</thead>
<tbody>
<?php foreach ($dbo->query($sql) as $nt) : ?>
<tr>
<td align="center">
<?= htmlspecialchars($nt['name']) ?>
</td>
<td><?= htmlspecialchars($nt['entry']) ?></td>
<td>
<button type="button" class="button" value="<?= htmlspecialchars($nt['displayid']) ?>"><?= htmlspecialchars($nt['displayid']) ?></button>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php endif;

Categories