its easier to make in javascript, in php you need to press submit button to calculate.
you need to close the lines with a ( ; ) semicolumn
when you want to embed html into your php script, you can break out of the php blocks:
<?php
$main=empty($_POST["main"])? 0 : int($_POST["main"]);
$val1=$main*4;
$val2=$main*45;
$val3=$main*487;
?>
form here
<input name="main" type="text" value="<?php echo $main ?>"><br />
<input name="val1" type="text" value="<?php echo $val1 ?>"><br />
<input name="val2" type="text" value="<?php echo $val2 ?>"><br />
<input name="val3" type="text" value="<?php echo $val3 ?>"><br />
submit here
<?php
rest of your code.
?>