php - Reload web page after form submission, hidden iframe

I am making a simple image uploader. I want it so:
- An image is uploaded, it calls a php script.
- The page is then refreshed
I am using a simple html form action. It does not refresh the web page after submission. To prevent the php script from overriding the web page, I put it in a hidden iframe.
I have never used javascript or ajax, so I am trying to avoid those solutions. This is a one-off for fun thing, so investing time into them isn't my goal.
<body>
<iframe name="votar" style="display:none;"></iframe>
<p class="standard_text_big" style="text-align:center"> No Pin Limit Will Stop Us!</p>
<p><form action="upload.php" method="post" target="votar" enctype="multipart/form-data" class="standard_text" style="text-align:center">
Upload a File:
<input type="file" name="the_file" id="fileToUpload">
<input type="submit" name="submit" value="Start Upload">
</form>
</p>
<div class = "image_format">
<picture class = "image_format">
<div id="img_embed"></div>
</div>
</picture>
</body>
EDIT Solved: Instead of doing this in the html page, I have removed the hidden iframe so the php script does take over. Then in the php script, after it executes, it sends you back to the html page.
Like so:
<p class="standard_text_big" style="text-align:center"> No Pin Limit Will Stop Us!</p>
<p><form action="upload.php" method="post" enctype="multipart/form-data" class="standard_text" style="text-align:center">
Upload a File:
<input type="file" name="the_file" id="fileToUpload">
<input type="submit" name="submit" value="Start Upload">
</form>
</p>
<div class = "image_format">
<picture class = "image_format">
<div id="img_embed"></div>
</div>
</picture>
Then in the php file:
if (empty($errors)) {
$didUpload = move_uploaded_file($fileTmpName, $uploadPath);
if ($didUpload) {
echo "The file " . basename($fileName) . " has been uploaded";
$command = escapeshellcmd('python3 /home/myfile.py');
$output = shell_exec($command);
echo $output;
header("Location: https://www.google.com"); /* Redirect browser */
exit();
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: mysqli::real_connect(): (hy000/2002): connection refused
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.