0
Good evening everyone, I have a PHP script that creates a table in which on this page is run an ajax script and you can see in real time who is in the database... in this table I have a delete button for each person and when clicking is created a variable $_GET with the process number (e. g searchstudent.php? usrdelete=5382 )
AJAX:
$('#textbox').keyup(function(){
$("#display_students").text('');
var name = $('#textbox').val();
if($.trim(name) != ''){
$.post('../core/Query/students/student_search.php', {st_process: name}, function(data){
$("#display_students").append(data);
});
}
});
PHP:
<?php
if(isset($_POST['st_process']) === true && empty($_POST['st_process']) === false){
include("../Query-core.php");
include('../db.php');
$authentication = new DBRequest($host = 'localhost',
$user = 'root',
$pass = '',
$db = 'contas');
$selectedstudents = $authentication->selectionQueryLike("alunos", $authentication->e(trim($_POST['st_process'])), "student_process");
if(mysqli_num_rows($selectedstudents) > 0){
echo "<table><tr><th>Nome</th><th>NºProcesso</th><th>ID</th><th>Apagar</th></tr>";
while($row = $selectedstudents->fetch_assoc()){
echo "<tr>";
echo "<td><a href='#'>" . $row["student_name"] . "</a></td>";
echo "<td>" . $row["student_process"] . "</td>";
echo "<td>" . $row["student_ID"] . "</td>";
echo "<td><a href=?usrdelete=" . $row["student_ID"] . ">Delete<a/></td>";
echo "</tr>";
}
echo "</table>";
}
}
?>
how could I simultaneously spend $_GET and $_POST in ajax?
Please avoid long discussions in the comments; your talk was moved to the chat
– Maniero