So long story short, I've enrolled myself in an MsC programme for PHP and SQL, it's strictly on a voluntary basis as I am studying something else on a Bsc level. This makes it tricky for me to ask my lecturer for help, as I'd feel a bit guily if I was to steal time from the 'real' students.
So, for my first assignment, I am to make a BMI calculator, I've been going at it for about 3 hours now and I still cannot make it work.
I keep getting this error message when I attempt to test it "( ! ) Parse error: syntax error, unexpected end of file in C:\wamp\www\handle-form.php on line 16"
I've added the code for the initial form and the php script below.
handle-form.html
Code: Select all
<html>
<head>
<title>Calculate your BMI</title>
</head>
<body>
<form action="handle-form.php" method="post"
<p><input type="text" name="$weight" size "10"<br>
<p>Please enter your weight in kilos</p>
<p><input type="text" name="$height" size "10"<br>
<br><p>Please enter your height in m</p>
<p><input type="submit" name="submit" value="Submit"/></p>
</form>
</body>
</html>handle-form.php
Code: Select all
<?php
if (isset($_POST['submit'])):
echo '';
$w = $_POST['weight'];
print_r("weight: $w<br/>");
$h = $_POST['height'];
print_r("$h height");
if(empty($c_temp)):
if(empty($c_temp)):
$b = (($w / $h) * $h);
print_r ("Your BMI is $b <br/>");
?>