Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/11/2013, 14:58
jukolipo
 
Fecha de Ingreso: noviembre-2013
Mensajes: 6
Antigüedad: 10 años, 5 meses
Puntos: 0
Comprobar codigo promocional

Hola,

Estoy haciendo una pagina web en la que el usuario debe introducir un codigo PIN y si el codigo es correcto (solo hay uno correcto), quiero que el usuario sea redirigido a una pagina que le felicite y si no es correcto, a una pagina que le anime a seguir intentandolo.

Hasta ahora este es el codigo HTML

<head>
<title> #MATCHAGAINSTPOVERTY </title>
<!-- Contents -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body bgcolor ="#B81321" >
</br>
<h1><font color="#FFFFFF"> <center> <b> MATCH AGAINST POVERTY </br> TOKYO 2014 </b> </font> </center> </h1>

<!--Imagen coca cola latas-->


<img src="http://img7.imageshack.us/img7/8145/yhry.png" alt="UNDP Match Against Poverty Promotion Cans" width="400" height="320">


<!--video promocion-->


<table align=""><embed width="420" height="345" src="http://www.youtube.com/v/hYIHizU7ndY"type="application/x-shockwave-flash"> </embed>
</table>





</br>
<!-- UNDP LOGO-->
<img src="http://www.fdcchildren.org/images/UNDP%20Logo.jpg" alt="UNDP Logo" width="50" height="120" align ="right">

<!--PIN code-->
<form action="premio.php" method="post">

<center><b><h3><font color="#FFFFFF"> Insert the PIN Code found at the back of your Coca Cola tab !</h3></b></font>


<font color ="#FFFFFF"> PIN Code: </font> <input type="text" name="code"><br>


<!--PIN code-->
<center><b><h3><font color="#FFFFFF"> Insert the PIN Code found at the back of your Coca Cola tab !</h3></b></font>
<form action="premio.php" method="post">
<font color ="#FFFFFF"> PIN Code: </font>
<input type="text" name="code" maxlength=6 />

</form></center>



</body>
</html>


El codigo correcto es "R9ZZ10" para premio.php es

<html>

<body color="#B81321">
<?php

if ($codigo=="R9ZZ10") {

echo "<h1><font color='#FFFFF'> <center> <b> Congrats </b> </font> </center> </h1>";

}
else {

echo '<font color="#FFFFFF" > <center> <b> SORRY </b> </center> </h1> </font>';
}
?>

</body>
</html>