I've developed an application which is used to display the details of an user. To update his/her photo, I provided a link which redirects to a page where the action takes place. The link is as follows:
<a onclick="update_me(id)" id="http://127.0.0.1/example/updateuploads.php?x=1/<?php echo $row[RegdNo]; ?>">click here</a> to upload a new photo.
The JS is as follows:
function update_me(x)
{
window.open(x,"uploadwind","width=800,height=200,scrollbars=no");
}
So, this opens a new window and when the user updates his/her photo, the window is closed automatically using window.close()
. When this window is closed, I want the page that displays the details of the user to be refreshed. For this, the JS I used is
window.onunload = refreshParent;
function refreshParent() {
window.opener.location.reload();
}
This works fine with Mozilla Fire Fox but when I test the same in Google Chrome, the $_POST
variable :
$x=$_POST['regdno'];
is being replaced with NULL, resulting in a blank page. How can I overcome this? Please help me! Thanks in advance!!
Neither of your Javascript functions actually fires a POST request. They're both sending GET requests. You need to either use AJAX to send a POST request or do a form submission.