|
Server IP : 10.128.40.6 / Your IP : 216.73.217.20 Web Server : Apache System : Linux webd006.cluster128.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : logmcpe ( 111175) PHP Version : 7.3.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/logmcpe/www/TMCPRO/pages/python/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
// print_r($_GET);
// print_r($_POST);
// $userAnswer =z $_POST['name'];
// echo json_encode($userAnswer);
// $DateAndTime = date('m-d-Y h:i:s a', time());
// echo "The current date and time are $DateAndTime.";
$date_heure_creation = date('d-m-Y h:i:s', time());
$date_heure_fin_tach = date('d-m-Y h:i:s', time());
// echo "The current date and time are $DateAndTimee.";
// exit() ;
// if(!empty($_POST))
// {
// echo "<pre>" ;
// print_r($_POST);
// echo "</pre>" ;
// exit();
// }
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css">
<script type='text/javascript' src='jquery-3.6.0.min.js'></script>
<title>PHP with Bootstrap form</title>
<style>
a{
color:white;
}
a:hover{
text-decoration:none;
color:white;
}
div{
background-color:silver;
margin-top:10px;
}
.font{
font-size:18px;
}
button{
color:white;
}
.constant{
background-color: blue;
}
.constant-clicked{
background-color: brown;
}
</style>
</head>
<body>
<div id='top_of_page'></div>
<?php
$data=dbi_query("SELECT * FROM table_1") ;
echo "<div class='container'><h3>table 1 data</h3>
<table class='table striped hover'>
<tr class='bg-light'><th>id_table_1</th><th>name</th><th>Insertion</th></tr>";
while($value=dbi_fetch_row($data)){
$id_table_one=$value['id_table_1'];
$select_table2_data=dbi_query("SELECT COUNT(*) FROM `table_2` WHERE `id_table_1`= $id_table_one");
$ary_value=dbi_fetch_row($select_table2_data);
if($ary_value[0] == 0){
echo "<tr class='text-black font'><td>".$value['id_table_1']."</td>
<td>".$value['name']."</td><td>
<button onclick='insertdata(".$value["id_table_1"].",$(this));' class='constant' style='
border-radius:10px;padding:10px;'
onfocus='change(this)'>
Insert into table 2</button></td></tr>";
}else{
echo "<tr class='text-black font'><td>".$value['id_table_1']."</td>
<td>".$value['name']."</td><td>
<button class='constant-clicked' style='
border-radius:10px;padding:10px;'
onfocus='change(this)'>
Insert into table 2</button></td></tr>";
}
}
echo "</table></div>";
//insert data from table 1 into table 2
// $insert_id=$_GET['inid'];
// $insert_data=mysqli_query($connections,"SELECT * FROM table_1 where id_table_1='$insert_id'") or die('query failed');
// $data_table_1=mysqli_fetch_assoc($insert_data);
// $data_table_1=$data_table_1['id_table_1'];
// $insert_data_table=mysqli_query($connections,"INSERT INTO table_2(id_table_1) values('$data_table_1');");
//color constant
// $select_table1_data=mysqli_query($connections,"SELECT * FROM table_1") or die('query 1 failed');
// while($fetch_data_table1=mysqli_fetch_assoc($select_table1_data)){
// while($fetch_data_table2=mysqli_fetch_assoc($select_table2_data)){
// if($fetch_data_table1['id_table_1']==$fetch_data_table2['id_table_2']){
// ?>
// <script>
// // document.getElementsByClassName("constant").style.backgroundColor="brown";
// // document.getElementsByClassName("constant").style.color="white";
// </script>
// <?php
// }
// else{}
// }
// }
// //end
?>
<script>
function insertdata(inid, element){
$.ajax({
url:"without_reloading.php",
type:"GET",
data:{
"inid":inid
},
success:function(data){
element.removeAttr('onclick');
}
});
}
function change(elements){
elements.style.backgroundColor="brown";
elements.style.color="white";
}
</script>
</body>
</html>