کد PHP:
<?php
if(ISSET($_POST['submit'])){
$a = $_POST['a'];
$b = $_POST['b'];
}else{
$a=0;
$b=0;
}
?>
<form action="" method="post">
<tr>
<th width="200" scope="row">a = </th>
<td><input type="text" name="a" value="<?php echo $a ?>" /></td>
</tr>
<tr>
<th width="200" scope="row">b = </th>
<td><input type="text" name="b" value="<?php echo $b ?>" /></td>
</tr>
<input type="submit" name="submit" value="Run">
</form>
<?php
echo "a+b=";
echo "$a" + "$b";
?>