latest Post

How to create multiplication table using php

Program: 

<html>
<body>
<form id="form1" name="form1" method="post" action="">
<center>
<h1 > MULTIPLICATION TABLE </h1>
  <table width="400" border="1" cellspacing="0" cellpadding="5" id="tbl" >
    <tr> <td width="144"><label for="start">Multiply From</label></td>
            <td width="330"><input type="text" name="start" id="start" /></td> </tr>
    <tr> <td><label for="end">Multiplt To</label></td>
          <td><input type="text" name="end" id="end" /></td> </tr>
  <tr> <td><label for="mult">Multiply By</label></td>
      <td><input type="text" name="mult" id="mult" /></td> </tr>
  <tr>  <td>&nbsp;</td> <td><input type="submit" name="submit" id="submit" value="Submit" /></td>
    </tr>
</table>
</center>
</form>
<?PHP
$times = 2;
if (isset($_POST['submit'])) {
$start = $_POST['start'];
$end = $_POST['end'];
$times = $_POST['mult'];
for($start; $start <= $end; $start++) {
$answer = $start * $times;
print $start . " multiplied by " . $times . " = " . $answer . "<BR>";
}}
?>
</body></html>

Output :


About Open Learning Creative

Open Learning Creative
Recommended Posts × +

0 comments:

Post a Comment

PHP Registration form using GET, POST Methods with example

Program : HTML Code <html> <head> <title>Student Info</title> </head> <body><center> ...