Ver Mensaje Individual
  #6 (permalink)  
Antiguo 20/01/2012, 14:51
rog3r_k
 
Fecha de Ingreso: octubre-2011
Mensajes: 5
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: imprimir echo con formulario html desde php...

Hola tigre aqui te hice un ejemplo...

pagina.html

<!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>Documento sin título</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
function data(){
$.post("web.php", $("#id_form").serialize(), function(data){
if(data=="error"){
alert("no has puesto datos en el formulario");
}else{
alert(data);
}
});
}
</script>
</head>

<body>
<form name="name_form" id="id_form" method="post">
<input type="text" name="txtDatos" id="txtDatos" />
<input type="button" name="btnButton" id="btnButton" value="dale chocke" onclick="data()" />
</form>
</body>
</html>




pagina web.php
<?php
if($_POST['txtDatos'] == ""){
echo "error";
}else{
echo "buena man: mandaste los siguientes datos: ".$_POST['txtDatos'];
}
?>



algo asi podrias trabajarlo!..... bueno si tienes conocimientos de php y de jquery.. se te hara sencillo...

si la respuesta que recibes es correcta podrias redireccionar la pagina con .... window.location.href='miotrapagina.php' desde el mismo javascript ... XD ....

bueno ahrioa si me paso a segui chambeando.... cuidateeeee!!!!!!