Ver Mensaje Individual
  #5 (permalink)  
Antiguo 06/09/2008, 10:32
DPini
 
Fecha de Ingreso: agosto-2008
Mensajes: 4
Antigüedad: 16 años, 6 meses
Puntos: 0
Respuesta: Actividad de mates: sumar, envio de variables

Asi no me funciona:

Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
    <title>sin título</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta name="generator" content="Geany 0.13" />
</head>

<body>
    <h1>Mates</h1>
    <h2>Sumes</h2>
    <?php
    
if(!isset($_POST[respalu]))
    {
        
$num1=rand(0,100);
        
$num2=rand(0,10);
        
$opr=$num1 $num2;
        echo 
"suma: $num1 + $num2";
        echo 
"<br />$opr" //para no ir teniendo que sumar mientras pruebo
    
?>
    <form action="matesuma.php" method="post">
    <input type="text" name="respalu">
    <input type="hidden" name="opr" value="$opr">
    <input type="submit" value="verifica">
    </form>
    <?php
}
else {
    echo 
"$opr";
    if(
$_POST[respalu]==$opr) {
        echo 
"correcte";
    }
    else{
        echo 
"incorrecte";
        echo 
"resposta correcte: $opr";}
    }
    echo 
"$opr"
    
?>
</body>
</html>