Hi, thanks, first of all, I'm new to programming and I've really searched and searched and I have not gotten information about it. This is what happens, I need to delete a field from the database and a confirmation appears but I can not capture the id that I want to be able to erase it .. help porfa here the code:
while (list($id,$nombre,$imagen)=mysql_fetch_array($query))
{
echo "$nombre";
echo "$imagen";
echo "<a title='Presione aca si desea borrar' href='borrar.php?id=$id' onclick='preguntar();return false;'>eliminar</a>";
echo "</br>";
}
and this is my javascript code
<script language="Javascript">
function preguntar()
{
eliminar=confirm("¿Deseas eliminar este registro?");
if (eliminar){
//Redireccionamos si das a aceptar
window.location.href = "borrar.php?id=<?php echo $id; ?>";
else
alert('No se ha podido eliminar el registro...')
}
</script>
I need to capture the id of record 3 for example and save it in a php variable and pass it by url to the window.location of js.