I have 3 php files: view.php
, edit.php
and edit2.php
.
view.php
is where I view the content of my database. I use edit.php
to enter new data and it's a small window that in which I type in a content I want to include in my db.
Then, I pass all of the data to edit2.php
which doesn't display anything but only has implemented MySQL queries.
Now I would like to have something like this:
I'm on view.php
. I click a button, edit.php
opens as a new, small window. I enter the data, click SUBMIT button, everything is sent to edit2.php
but at the same time the window is closed and view.php
is refreshed.
I would be thankful if you could help. Thanks in advance.
I have 3 php files: view.php
, edit.php
and edit2.php
.
view.php
is where I view the content of my database. I use edit.php
to enter new data and it's a small window that in which I type in a content I want to include in my db.
Then, I pass all of the data to edit2.php
which doesn't display anything but only has implemented MySQL queries.
Now I would like to have something like this:
I'm on view.php
. I click a button, edit.php
opens as a new, small window. I enter the data, click SUBMIT button, everything is sent to edit2.php
but at the same time the window is closed and view.php
is refreshed.
I would be thankful if you could help. Thanks in advance.
Share Improve this question edited Jul 28, 2014 at 9:21 whiteestee asked Jul 28, 2014 at 9:08 whiteesteewhiteestee 3011 gold badge4 silver badges12 bronze badges 3- how r you saving the data?? with ajax?? – Sougata Bose Commented Jul 28, 2014 at 9:13
- I use html post method and I send it to mysql query – whiteestee Commented Jul 28, 2014 at 9:14
- if you are doing this all on server side the user header function of php.else use window.opener.location.reload() after saving data via ajax – Sougata Bose Commented Jul 28, 2014 at 9:22
3 Answers
Reset to default 4You can use the js function window.opener.location.reload()
.There is no need of ajax for refreshing the page..Simple js is enough.
You may use header('Location: view.php'); at the end of your edit2.php
Add following code to your edit.php
<script>
window.onunload = refreshParent;
function refreshParent() {
window.opener.location.reload();
}
</script>