lunes, 1 de marzo de 2010

Generar tabla de multiplicar según datos ingresados


<table>

<form method="post">

<tr>

<td>Nº1</td><td><input type="text" size="5" name="n1" /></td>

</tr>

<tr>

<td>Nº2</td><td><input type="text" size="5" name="n2" /></td>

</tr>

<tr>

<td colspan="2" align="center"><input type="submit" value="Ver tabla"/></td>

</tr>

</form>

</table>

<?php

$n1=$_POST["n1"];

$n2=$_POST["n2"];

?>

<p align="center">TABLA DE <? echo $n1;?> * <? echo $n2;?></p>

<?php

$a=0;

$x=0;

$b=10;

?>

<table align="center">

<?php

for($a=1;$a<=$n1;$a++)

{

echo"<tr>";

for($x=1;$x<=$n2;$x++){

echo"<td>";

echo $x*$a;

echo"</td>";

}

echo"</tr>";

}

?>

</table>

1 comentario:

  1. d vdd !! k vale la pena entrar a ste blog !! muchas gracias por la ayuda resuelta... !!!!

    ResponderEliminar