Documentos de Académico
Documentos de Profesional
Documentos de Cultura
<!DOCTYPE HTML>
<html lang="es-ES">
<head>
<meta charset="UTF-8">
<title>Suma de 2 numeros en PHP</title>
</head>
<body>
<H2>Suma de 2 numeros en PHP</H2>
<form action="suma.php" method="POST">
<table>
<tr>
<td><input type="text" name="numero1"></td>
</tr>
<tr>
<td><input type="text" name="numero2"></td>
</tr>
<tr>
<td> <input type="submit" value="sumar"> </td>
</tr>
</table>
</form>
</body>
</html>
<?php
if($_POST)
{
$num1 = $_POST
['numero1'];
$num2 = $_POST
['numero2'];
$suma = $num1
+ $num2;
echo "La suma de ".$num1." y ".$num2." es ".$suma;
}
?>
<html>
<head>
<title></title>
<script>
function sumar() {
var n1 = parseInt(document.MyForm.numero1.value);
var n2 = parseInt(document.MyForm.numero2.value);
document.MyForm.resultado.value=n1+n2;
}
</script>
</head>
<body>
<form name="MyForm">
<input type="text" name="numero1" size="20">
<input type="text" name="numero2" size="20">
<input type="text" name="resultado" size="20">
</body>
</html>
.
Calculadora en php
<html>
<head>
<title>Formulario.</title>
</head>
<body>
</body>
</html>
===============================
<html>
<head>
<title>Sumar.</title>
</head>
<body>
<?php
$valor1 = $_POST['T1'];
$valor2 = $_POST['T2'];
$valor3 = $_POST['T3'];
<html>
<head>
<title>Calculadora bsica en html y php por eat7herich</title>
</head>
<body>
<?
if($cifra1==0)
{
echo "ERROR 01: No ingreso la primer cifra.<br>";
}
if($cifra2==0)
{
echo "ERROR 02: No ingreso la segunda cifra.";
}
else
{
echo "Resultado de la operacin:<br>";
$resultadodivision=$cifra1/$cifra2;
$resultadomultiplicacion=$cifra1*$cifra2;
$resultadoresta=$cifra1-$cifra2;
$resultadosuma=$cifra1+$cifra2;
if($sumar)
echo $resultadosuma;
if($restar)
echo $resultadoresta;
if($multiplicar)
echo $resultadomultiplicacion;
if($dividir)
echo $resultadodivision;
}
?>
<br><br><A HREF=calculadora.htm>Realizar una nueva operacin.</A>
</body>
</html>