Add another upload box button acting as "submit" button

If you look at this form: http://kmkwebdevelopment.com/formtest/upload.php you will see that when you click on the “add another upload box” button, instead of it adding another upload box, it is submitting the form for some reason. Can anyone see where the error lies?
Relevant snippet of code below:

<?php //deafult number of upload boxes
$upload_quant = 4;
//if the user increased the number of boxes
if(isset($_POST['increase_upload']))
{
//increasing the number of upload boxes
$upload_quant = $_POST['previous_upload'] + 1;
}
$upload_quantity = $_POST['previous_upload'];
//getting all the names into an array
$uplaoded_array = array();
for($i=0;$i<$upload_quantity;++$i)
{
$ii = $i+1;
$upload_name = 'upload'.$ii;
$get_upload_name = $_POST['$upload_name'];
array_push($uplaoded_array,$get_upload_name);
} ?>

<form class="uploadform" action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" enctype="multipart/form-data" onSubmit="return CheckForm(this);">
<?php IsThereErrors("0", $_iserrors); ?>
<input type="hidden" name="_referer" value="<?php echo $_referer ?>">
<input type="hidden" name="_next_page" value="1">
<p class="form_expert_style"><input name="URL" type="text" value=""/></p>

<table>
<tr>

    





<td>First Name *</td>

    





<td><input type='text' size='30' name='firstname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("firstname", "") ?> value="<?php echo isset($_values["firstname"]) ? htmlspecialchars($_values["firstname"]) : "" ?>"></td>
</tr>
<tr>

    





<td>Last Name *</td>

    





<td><input type='text' size='30' name='lastname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("lastname", "") ?> value="<?php echo isset($_values["lastname"]) ? htmlspecialchars($_values["lastname"]) : "" ?>"></td>
</tr>
<tr>

    





<td>E-mail *</td>

    





<td><input type='text' size='30' name='email'  onblur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("email", "") ?> value="<?php echo isset($_values["email"]) ? htmlspecialchars($_values["email"]) : "" ?>"></td>
</tr>
<tr>

    





<td>Company Number *</td>

    





<td><input type='text' size='30' name='companynumber' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("companynumber", "") ?> value="<?php echo isset($_values["companynumber"]) ? htmlspecialchars($_values["companynumber"]) : "" ?>"></td>
</tr>

<?php for($i=0;$i<$upload_quant;++$i)
{
$ii = $i+1;
$upload_name = 'upload'.$ii;
echo <<<_END
<tr>
<td>Upload $ii</td>
<td><input class="image" type='file' size='30' name='$upload_name'></td>
</tr>
_END;}
echo <<<_END
<tr>
<td>
<input type="hidden" value="$upload_quant" name = "previous_upload"/>
<input type="submit" name="increase_upload" value="Add another upload box" />
</td>
<tr>

<td><input type="submit" name="SubmitBtn" onClick="CheckForm1();" value="SUBMIT" /></td>
</tr>
</table>
</form>
_END;}
?>

    





</html>

<?php 

Thanks

Is this the same thread as here ?

Well, it’s submitting the form because it’s an <input type=“submit”> element. If it’s not going to do anything form-related then it should just be a <button>. In addition, for it to add more boxes, it would have to interact with some JavaScript that would respond to the user clicking the button. Then JavaScript would create the additional upload fields.

I can’t see any JavaScript that would do that, but then yours is pretty difficult to read as lots of the whitespace has been removed.

Also, for <script> elements, the language attribute is deprecated. You should use type=“text/javascript” instead. You also shouldn’t use a table to lay out the form elements. And <center> is deprecated as well and should not be used. I recommend you put that page through the validator sooner rather than later.