One form, posting to two scripts?

Reply

Join Date: May 2005
Posts: 232
Reputation: nathanpacker is an unknown quantity at this point 
Solved Threads: 0
nathanpacker's Avatar
nathanpacker nathanpacker is offline Offline
Posting Whiz in Training

One form, posting to two scripts?

 
0
  #1
Sep 22nd, 2006
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!
Last edited by nathanpacker; Sep 22nd, 2006 at 6:07 am.
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,085
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Re: One form, posting to two scripts?

 
0
  #2
Sep 22nd, 2006
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:

  1. <script>
  2. window.opener.location.href = 'http://example.com?param=value';
  3. </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!
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 232
Reputation: nathanpacker is an unknown quantity at this point 
Solved Threads: 0
nathanpacker's Avatar
nathanpacker nathanpacker is offline Offline
Posting Whiz in Training

Re: One form, posting to two scripts?

 
0
  #3
Sep 22nd, 2006
Thanks. Guess I'll have to brush up on some javascript and learn how to set those parameters.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 1343 | Replies: 2
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC