A
Anonymous
Guest
Hi,
To avoid posting when the user hits the page, you have to enclose the code into: if(isset($_POST['upload'])), upload being the name of the submit button (i would change the form name since it is the same than the submit button).
Besides, in the form tag, you have to specify an action, that tells the form what to do when submitting. The action usually is a js or a php file that processes your form info. The syntax is: <form name="upload" id="upload" ENCTYPE="multipart/form-data" method="post" action="processform.php">. Based on your code, i'd use action="<?php echo $_SERVER['PHP_SELF'];?>", that means the form will be processed in the same page it is being generated.
Hope it helps.
To avoid posting when the user hits the page, you have to enclose the code into: if(isset($_POST['upload'])), upload being the name of the submit button (i would change the form name since it is the same than the submit button).
Besides, in the form tag, you have to specify an action, that tells the form what to do when submitting. The action usually is a js or a php file that processes your form info. The syntax is: <form name="upload" id="upload" ENCTYPE="multipart/form-data" method="post" action="processform.php">. Based on your code, i'd use action="<?php echo $_SERVER['PHP_SELF'];?>", that means the form will be processed in the same page it is being generated.
Hope it helps.