My form produces the correct information on the second page. However, before it displays the right answer I get several “Undefined offset” error message. If you notice the correct answer is posted beneath all the error messages.
Here is the code from the two pages.
first page:
<td width="82"><div align="center">
<input type="checkbox" name="128" value="128">
</div></td>
<td width="82"><div align="center">
<input type="checkbox" name="64" value="64">
</div></td>
<td width="82"><div align="center">
<input type="checkbox" name="32" value="32">
</div></td>
<td width="82"><div align="center">
<input type="checkbox" name="16" value="16">
</div></td>
<td width="82"><div align="center">
<input type="checkbox" name="8" value="8">
</div></td>
<td width="82"><div align="center">
<input type="checkbox" name="4" value="4">
</div></td>
<td width="82"><div align="center">
<input type="checkbox" name="2" value="2">
</div></td>
<td width="82"><div align="center">
<input type="checkbox" name="1" value="1">
</div></td>
<td width="96"></td>
</tr>
Second PHP page:
<?php $var1 = $_POST['128']; $var2 = $_POST['64']; $var3 = $_POST['32']; $var4 = $_POST['16']; $var5 = $_POST['8']; $var6 = $_POST['4']; $var7 = $_POST['2']; $var8 = $_POST['1']; $add = $var1 + $var2 + $var3 + $var4 + $var5 + $var6 + $var7 + $var8; $sum = $add; echo "The answer is ", $sum; ?>[php][/php]