upload image in php and see it appears directly inside a lightbox before save it
<p>I have create a profile page in php. The following piece of code enables me to upload an image file. How can I modify my code so that when I upload the picture, to see it appears dirrectly  inside the lightbox?</p>

<pre><code>&lt;a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'"&gt;&lt;img src="img/upload.jpg"/&gt;&lt;/a&gt;
&lt;div id="light" class="white_content"&gt;

  &lt;div class="profile"&gt;
            &lt;?php

                if(isset($_FILES['profile'])===true){



                    if( empty($_FILES['profile']['name']) === true ){
                    echo'&lt;font color="#963" face="helvetica,arial,sans-serif" &gt; Please choose an Image File !&lt;/font&gt;';
                    echo'&lt;/br&gt;&lt;/br&gt;';
                    }else{


                        $allowed = array('jpg', 'jpeg', 'gif', 'png');                          
                        $file_name = $_FILES['profile']['name'];
                        $file_extn = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));   


                        $file_temp = $_FILES['profile']['tmp_name'];


                        if( in_array($file_extn, $allowed)===true ){
                            change_profile_image($session_user_id, $file_temp, $file_extn);
                            header('Location: ' . $current_file);
                            exit();
                        }

                        else{
                            echo'&lt;font color="#963" face="helvetica,arial,sans-serif"&gt;Incorrect file type! Allowed:';
                            echo implode(', ', $allowed);
                            echo'&lt;/br&gt;&lt;/br&gt;&lt;/font&gt;';
                        }

                    }
                }


                if(empty($user_data['profile'])=== false ){
                    echo '&lt;img src="', $user_data['profile'], '" alt="', $user_data['name'], ' - Profile Image"&gt;';
                }else   echo ' &lt;img src="img/photo.jpg"/&gt; ';


            ?&gt;

                &lt;form action=""  method="post" enctype="multipart/form-data"  &gt;
                    &lt;/br&gt;&lt;input type="file" name="profile" &gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;
                    &lt;input type="submit" value="" name="submit" style="background:url('img/save.jpg') no-repeat; width:90px; height:19px; border:none;  cursor:pointer;"&gt;
                &lt;/form&gt;

&lt;/div&gt;

&lt;a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'"&gt; 
&lt;img src="img/done_editing.jpg"/&gt;&lt;/a&gt;&lt;/div&gt;  &lt;div id="fade" class="black_overlay&gt;&lt;/div&gt;     
</code></pre>
