I'm trying to show a list from database on my website. Actually the function is just an echo "hello". It's not a database problem.
So, when I press this button: https://imgur.com/a/x0QUZJe It shows http://localhost/dashboard/
I've debugged the project and when I press the button, it reaches to this file, loading localhost/dashboard/
I think something is wrong, I have another project where I add/delete and list users from a database, made by me, it works perfectly and when I debug it, it never loads this code. This project is like a copy-paste at the moment.
<?php
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
$uri = 'https://';
} else {
$uri = 'http://';
}
$uri .= $_SERVER['HTTP_HOST'];
header('Location: '.$uri.'/dashboard/');
exit;
?>
Something is wrong with the XAMPP installation :-(
This code refers to C:\xampp\htdocs\index.php
My another almost-identical project is working perfectly, is not receiving this error on onClick function.
HTML code:
<div id="caja" style="text-align: center">
<input type="button" name="bMostrarCenso" id="bMostrarCenso" value="Mostrar censo" onclick="mostrarCenso()" class="boton"/>
<div id="listado"></div>
</div>
mostrarCenso() is sent to this javascript file:
function mostrarCenso(){
document.getElementById("listado").style.display='block';
var xmlhttp;
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("listado").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "controladorVotantes.php?showCenso", true);
xmlhttp.send();
}
showCenso goes to controladorVotantes.php:
if (isset($_REQUEST['showCenso'])) { //MOSTRAR CENSO
echo "hello";
}