Tengo 2 archivos, data.php y respaldar_data.php, lo cual me respalda la base de datos que yo seleccione, todo ese proceso lo hace correctamente.
Yo quiero que al momento de enviar el formulario me aparezaca una imagen que le indique al usuario que el respaldo se esta cargando (p.e. un gif animado) y luego mostrar el mesaje de que el respaldo se realizo correctamente.
Dejo el codigo aqui:
data.php
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Existencia de Productos</title>
<link rel="stylesheet" type="text/css" href="css/estilos.css" />
</head>
<body>
<?php
include("conex.php");
?>
<div align="center"><strong> SELECCIONE LA BASE DE DATOS A RESPALDAR</strong> </div>
<?php
$result=mysql_list_dbs();
?>
<table width="400" border="0" align="center">
<tr>
<form name='respaldo' method='post' action='respaldar_data.php' >
<th width="150" scope="row" bordercolor="#F0F0F0" class="fondo"><label>Nombre del Respaldo:</label></th>
<td colspan="6" align="center" bgcolor="#CCCCCC"><input name="backup" type="text" value="" size="25" maxlength="55" title="Nombre del Respaldo" class="inputboxInicio" /><br/></td>
<tr>
<td colspan="3" align="center" bordercolor="#F0F0F0" class="fondo">
<label><strong> Base de Datos: </strong></label>
<td width="139" bgcolor="#CCCCCC">
<label> Datas: </label>
</td>
<td width="41">
<select name = "datas" title="Datas">
<?php
while ($resultado = mysql_fetch_array($result))
{
//$resultado[0] = 'Deportivos 2000';
echo "<option value={$resultado['0']}>{$resultado['0']}</option>";
}
mysql_free_result($result);
?>
</select>
</td>
</tr>
<tr>
<td colspan="7" bgcolor="#CCCCCC"><div align="right"> <input name="respaldar" type="submit" value="Respaldar" class="boton" />
</div></td>
</tr>
</form>
</tr>
</table>
</div>
</body>
</html>
Código PHP:
<?php
$backup = $_POST['backup'];
$data = $_POST['datas'];
$fecha = date("Y-m-d");
system("mysqldump -h localhost -u root $data > ../respaldos/".$backup."_".$fecha.".sql ");
echo "<script>alert('Respaldo Completado!')</script>";
echo "<script> window.history.back(-1) </script>";
?>
Saludos y espero prota respuesta.