| | |
One form, posting to two scripts?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
I've written a php script that displays a summary table with certain select information from a database table. It has a "view" button next to each row, which takes the user to a printable form with the complete information from the table on it. There is a portion on this form where the user can add more information to the form. The user clicks a button on the form, and a small window pops up, with a text area and a submit button. It all works fine and dandy, the information gets submitted to the table, and the little window dissapears. Only problem is, you have to refresh the page to see the data relfected on the screen.
My qustion is, how can I get it to automatically refresh that page so that the information will show, without them having to resend the data from the table? Here's the code for the popup window:
[PHP]<?
echo "<img src=\"someimage.jpg\"></img><br>";
echo "<br>
Type your notes below and click \"Submit.\"
<form method=post action=update_notes.php>
<textarea name=\"notes\" rows=\"5\" cols=\"30\"></textarea><br>
<input type=hidden name=request_id value=" . $_POST['request'] . ">
<input type=submit value=submit>
</form>";
?>[/PHP]
As you can see, it uses some information from the previous page to tell the mysql database which row to post the data on.
The page I want reloaded is called print_forms.php. I found some javascript that will automatically reload it, but without resubmitting the php data to it, the form comes up empty.
So somehow I was think that when the user clicks that submit button, it would post the notes to "update_notes.php", but then it would also reload the "print_forms.php" page while passing the requestid to it, so it knows what data to load it with. Ideas?
I know I've been mostly a leech on this forum, and haven't been able to contibute much yet. But I promise as I get more experienced I will contribute! Thanks for all your help!
My qustion is, how can I get it to automatically refresh that page so that the information will show, without them having to resend the data from the table? Here's the code for the popup window:
[PHP]<?
echo "<img src=\"someimage.jpg\"></img><br>";
echo "<br>
Type your notes below and click \"Submit.\"
<form method=post action=update_notes.php>
<textarea name=\"notes\" rows=\"5\" cols=\"30\"></textarea><br>
<input type=hidden name=request_id value=" . $_POST['request'] . ">
<input type=submit value=submit>
</form>";
?>[/PHP]
As you can see, it uses some information from the previous page to tell the mysql database which row to post the data on.
The page I want reloaded is called print_forms.php. I found some javascript that will automatically reload it, but without resubmitting the php data to it, the form comes up empty.
So somehow I was think that when the user clicks that submit button, it would post the notes to "update_notes.php", but then it would also reload the "print_forms.php" page while passing the requestid to it, so it knows what data to load it with. Ideas?
I know I've been mostly a leech on this forum, and haven't been able to contibute much yet. But I promise as I get more experienced I will contribute! Thanks for all your help!
Last edited by nathanpacker; Sep 22nd, 2006 at 6:07 am.
Hi Nathanpacker,
This is actually a JavaScript question, and yes is possible. You just have to put a piece of javascript on the child window, that reloads the parent window with the url parameters you want.
The code looks ssomething like:
This is actually a JavaScript question, and yes is possible. You just have to put a piece of javascript on the child window, that reloads the parent window with the url parameters you want.
The code looks ssomething like:
PHP Syntax (Toggle Plain Text)
<script> window.opener.location.href = 'http://example.com?param=value'; </script>
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
![]() |
Similar Threads
- posting data from a form to msg broker fail (RSS, Web Services and SOAP)
- Need Support from all of you. (Geeks' Lounge)
- asp form action script (Site Layout and Usability)
- mysql_query() failing. Why? (PHP)
- dual simultanious actions from 1 form (ASP)
- When a host says "included scripts" (Networking Hardware Configuration)
Other Threads in the PHP Forum
- Previous Thread: website help
- Next Thread: errors showing up when page isn't running
Views: 1343 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax alexa apache api array beginner beneath binary broadband broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion redirect regex remote script search select server sessions sms smtp soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube






