I was wondering if anyone can help.
I'm trying to create an online volumetric calc, based on the following formula
=SUM(((height+width)*2)+length)/100
I have created the form and the php code to create this.
<form name="calc" method="post"> <center><table width="248" border="1" class="tabledetails"> <tr> <td colspan="2">Volumetric Calc</td> </tr> <tr> <td width="114">Length (in cm)</td> <td width="144"><center><input name="length" type="text" id="length" size="10" maxlength="10" /></center></td> </tr> <tr> <td>Width (in cm)</td> <td><center><input name="width" type="text" id="width" size="10" maxlength="10" /></center></td> </tr> <tr> <td>Height (in cm)</td> <td><center><input name="height" type="text" id="height" size="10" maxlength="10" /></center></td> </tr> <tr> <td> </td> <td><center> <input type="reset" name="Reset" value="Reset" /> <input type="submit" name="Submit" value="Calc"></center></td> </tr> </table> </center> </form>
<? if($_POST['Submit']!=''){ $variable_a = $_POST['length']; $variable_b = $_POST['width']; $variable_c = $_POST['height']; $result = ((($variable_c + $variable_b) * 2) + $variable_a) / 100; echo "<center></br><h1>Length & Girth Combined is $result metres</br>Length = $variable_a cm </br>Width = $variable_b cm </br> Height = $variable_c cm</h1></br></br><h2>If the length and girth combined are greater than 3m then the parcel can not be sent internationally.</h2></center>";
} ?>
However, when I run this in the first instance and display the form, I receive the following message:-
Notice: Undefined index: Submit in xxxx on line 94 and the form is shown. As soon as you click on the calc button, this works absolutely fine, and echoes the information to the screen, as it should, and the message disappears
I'm just stumped why it displays the Undefined index: Submit message, and how can I resolve this?
Regards
Dave