Ver Mensaje Individual
  #5 (permalink)  
Antiguo 16/09/2009, 14:28
manupalaya
 
Fecha de Ingreso: enero-2007
Mensajes: 156
Antigüedad: 17 años, 3 meses
Puntos: 3
Respuesta: Rellenar variables con cajas de texto

Genial!
Muchas gracias, funciona muy bien, dejo el codigo completo, para algún novato como yo.

Código PHP:
<?php
Function informes ()
{
 global 
$fecha_inicio;
 global 
$fecha_final;

 echo 
$fecha_inicio;
 echo 
$fecha_final;
}
if (isset(
$_POST['envio'])){
$fecha_inicio=$_POST['fecha_inicio'];
$fecha_final=$_POST['fecha_final'];

mysql_connect("localhost""usuario""password") or die(mysql_error());
mysql_select_db("nombre_base_datos") or die(mysql_error());

$sqltgastos="SELECT sum(Gastos) FROM employee WHERE Fecha BETWEEN '$fecha_inicio' AND '$fecha_final'";
$rstgastos=mysql_query($sqltgastos);
$resTgastos=mysql_result($rstgastos,0,0);
echo 
"<br>";
echo 
"<b>Gastos ".$mes."= </b>".number_format ($resTgastos,2","".")."&euro;<br>";
}

else {
echo 
"<form method='post' action=''>";
echo 
"Fecha inicio:<input type='text' name='fecha_inicio' value=''>";
echo 
"Fecha fin:<input type='text' name='fecha_final' value=''>";
echo 
"<input type='submit' name='envio' value='Enviar'>";
echo 
'</form>';
}  
?>