Tema: Php ayuda
Ver Mensaje Individual
  #5 (permalink)  
Antiguo 31/10/2009, 02:45
Raftuz
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: Php ayuda

Sique sin funcionar
Código PHP:
<?php

$bd
=mysql_connect ("localhost","root"," ") or die ("No puedo conectarme");
mysql_select_db("b18_4386695_emails");

$opt=$_POST["opt"];

if (
$opt==1)
{
  
$Correo=$_POST["Correo"];
   
  
$sql="insert into correo (Emails) values ('$Correo')";
  
$res=mysql_query($sql,$bd) or die (mysql_error ());
}

?>

<html>
<head>
<title>Documento sin título</title>
</head>

<script language="javascript">
function verifica ()
{
  if (form1.Correo.value=="")
    {
      alert ("Ingrese su email");
      return;
   }
 form1.opt.value=1;
 form1.submit(); 
}
</script>


<body>
<form id="form1" name="form1" method="post" action="">
<input type="hidden" name="opt"
  <p>Correo Electronico: 
    <label for="Correo"></label>
  <input type="text" name="Correo" id="Correo" />
  </p>
  <p>
    <label for="Enviar"></label>
    <input type="submit" name="Enviar" id="Enviar"  value="Enviar" onclick=verifica()>
  </p>
</form>
</body>
</html>