Ver Mensaje Individual
  #5 (permalink)  
Antiguo 16/06/2009, 19:19
Avatar de nolose
nolose
 
Fecha de Ingreso: diciembre-2007
Ubicación: España
Mensajes: 165
Antigüedad: 16 años, 5 meses
Puntos: 2
Respuesta: Problema para comparar dos campos

No me entra en la funcion.

Te paso algo de codigo a ver...

Código PHP:
<? include_once 'pregunta_spam.php'?>

<html> 
<head>
<title>[ contactar ]</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">



<link rel="stylesheet" type="text/css" href="style.css"> 
<style type="text/css">
<!--
body {
    background-color: #FFFFFF;
    margin-bottom: 40px;
    margin-left: 0px;
    margin-top: 40px;
    margin-right: 0px;
}
-->
</style>

<?php 

function valida_imagen(){

    if(
$_POST['imagen']==$_SESSION['spamkey']){
        return 
true;
     }else{
         return 
false;
     }
}
?> 

</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100%" align="left" valign="top"><form name=form_contacto action="procesa.php" method="post" onSubmit="return valida_imagen(this)">
      <table width="440" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="82%" align="left" class="cssnegro" style="padding-top:15px"><? pregunta_spam(); ?></td>
        </tr>
        <tr>
          <td style="padding-top:15px" align="left" class="cssnegro"><span class="cssnegro" style="padding-top:15px">
            <input name="imagen" type="text" id="imagen" size="28" maxlength="60">
            <? echo $_SESSION['spamkey'] ;?></span></td>
        </tr>
        <tr>
          <td style="padding-top:26px" align="left"><input name="contacto" type="submit" value="Enviar" onClick="javascript:valida_imagen();"></td>
        </tr>
      </table>
    </form></td>
  </tr>
</table>
</body>
</html>

Creo que es mas dificil de lo qu parece... pero vamos no se...