I will try to break it down as much as i can:
First we have your form:
Php can not read elements like javascript or css can so you need to include what you want inside form. In form you must define the method you are going to use (post,get) and the action which is your php file. I provide you a sample form to help you understand
<form method="post" action="test2.php">
<p>Photo: </p><input id="imgrace" type="file" name="imguser"/>
<input type="submit" id="imguser" name="imguser2"/>
</form>
After that we move to php section:
In php file i need to receive what i am sending. The method that i set in html must be the one that receives in php and of course the same file name. I present you a sample of php file:
$data=$_POST['imguser'];
echo "<img src='/$data' />";
What this 2 files are doing is simple. I upload an image from the html page, i capture it and display it in php page. My variable $data
has all the info i need (the image name) to display the image and except of display i can simple store it into a DB. Also you need to submit your form. Php is not real-time like ajax calls or javascript functions so needs to "refresh".