Update information


#1

I’m working on a project involving an online database, now I have entered some information into the db.
The thing I want to do is to update this information with a popup.
The way I have it now is that I have a presentationpage and on that page I would like to have a link that says update.
When I click the link a popup should appear with a form in it that I can use to update the information in the db, close the popup and update the presentationpage.

Now, creating a popup with a form and updating the database is not the problem, the problem is that I dont know how to make the connection between the popup and the main-page when the update is done.

I hope that I have made myself understandable…


#2

You should be able to do this with a piece of JavaScript linked to submitting the form:

<form action="YOUR_URL" method="POST" onsubmit="update_parent()">
... your form elements ...
</form>

<script>
function update_parent() {
  this.opener.refresh();
}
</script>

NOTE: this code was a 5-second nobrainer (I know the ‘opener’ part is correct though), so it may not work, but at least it’ll give you an idea of what to look for.


#3

Thank you so much, it works great with a small modification.

<script> 
function update_parent() { 
  window.opener.location.href = window.opener.location.href;
  window.close(); 
} 
</script>