ok listo men
en vez de hacer el insert cuando exista la variable cneed , hacerlo cuando oprima el boton submit del formulario.
Código HTML:
Ver original<?php
$primer_cneed = $_GET['cneed'];//recibes la variable que enviaste por la funcion javascript
?>
<form name="formulario" method="post" action="Final.php?cneed_final=<?php echo $primer_cneed; ?>/>
<input type="text" name="nombre" id="nombre" maxlength="24" value=""/> <input type="password" name="password" id="password" value="" maxlength="12"> <input name="submit" type="submit" value="Enviar" name="accion"/>
<?php
if(isset($_POST['accion'])) {// validas cuando se envie el form
$segundo_cneed = $_GET['cneed_final'];// recibes el valor enviado por el action del form
$fecha = date('Y-m-d');
$nombre= $_POST[nombre];
$password= $_POST[password];
$ingresar_usuario = "INSERT into control_de_peso (nombre, password, fecha, calorias_totales) VALUES('$nombre', '$password', '$fecha','$segundo_cneed')";
mysql_query($ingresar_usuario, $Conexion);
}
?>