lo que quiero hacer es lo siguiente: abajo en mi formulario intento imprimir la variable $x pero no no logro que es lo que tengo que hacer par que se pueda imprimir, muchas gracias por adelantado!
Este es mi codigo:
Form
Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Formulario simple</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function(){
$("#form1").submit(function(){
$.ajax({
type:"POST",
url:"send.php",
dataType:"html",
data:$(this).serialize(),
beforeSend:function(){
},
success:function(response){
$("#response").html(response);
}
})
return false;
})
})
</script>
</head>
<body>
<div id="loading" style="display:none;"><img src="http://www.forosdelweb.com/f18/images/loading.gif" ></div>
<form name="form1" id="form1" method="post">
<fieldset class="login">
<legend>Perfil</legend>
<div>
<label>Nombre</label>
<input type="text" name="name" id="name" value="">
</div>
<div>
<button type="submit" name="enviar" >Enviar</button>
</div>
</fieldset>
</form>
<?php echo $x; ?>
</body>
</html>
Pagina donde se manda el valor
Código PHP:
<?php
if ($_POST['name']==""){
echo $x='error';
}
?>