Hi guys. So I've written my first ever PHP script to calculate how many posts and panels my customers will need.
My question is : How do I post the results of the form entry into the same html page?
so basically my goal is: they enter thier fence length, and then the results of my script are instantly shown without re-loading the page.
Thanks if anyone can help.
Here's my first ever code:
[INDENT]<?php
$fence = $POST['length'];
$posts = $fence/6;
$existing = $POST['existing'];
if ($existing == "yes")
echo "You will need " . round($posts) . " posts & " . round($posts) . " Panels";
else
echo "You will need " . round($posts+1) . " posts & " . round($posts) . " Panels";
?>[/INDENT]
And here's my form
[INDENT]<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<form action="post-calc.php" method="post" name="form">
<p>
What is your required Fence LENGTH?<br />
<br /><input type="text" name="length" size="30" style="border: 1px solid #808080">
<label><br />
<br />
Do you have an existing post already?<br />
<br />
<select name="existing" id="existing">
<option>yes</option>
<option>no</option>
</select>
</label>
</p>
<p>
<input type="submit" value="Submit" name="B1" />
</p>
</form>
</body>
</html> [/INDENT]
Thanks in advance
Shane