Está en la página 1de 2

ejer01.

php

.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Documento sin t&iacute;tulo</title>

</head>

<body>

<form id="form1" name="form1" method="post" action="/ejercicio/ ejer02.php">

INGRESE PRIMER VALOR:

<label>

<input name="valor1" type="text" id="valor1" size="15" maxlength="15" />

</label>

<p>INGRESE EL SEGUNDO VALOR:

<label>

<input name="valor2" type="text" id="valor2" size="15" maxlength="15" />

</label>

</p>

<p>

<label>

<input name="radio" type="radio" value="suma" />

</label>

SUMAR</p>

<p>

<label>

<input name="radio" type="radio" value="resta" />

</label>

RESTAR </p>

<p>

<label>

<input type="submit" name="Submit" value="Enviar" />


</label>

</p>

</form>

</body>

</html>

ejer02.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Documento sin t&iacute;tulo</title>

</head>

<body>

<?

$radio=$_POST['radio'];

$valor1=$_POST['valor1'];

$valor2=$_POST['valor2'];

$resultado=0;

if($radio == "suma"){

$resultado=$valor1+$valor2;

echo "El resultado de la suma es ".$resultado.".";

}else{

$resultado=$valor1-$valor2;

echo"El resultado de la resta es ".$resultado.".";

?>

<p>&nbsp;</p>

<p><a href="/sitiodeprueba2/ravila_ejer18_01.php">volver</a></p>

</body>

</html>

También podría gustarte