budimir Posted August 7, 2008 Share Posted August 7, 2008 Guys, is it possible to use one form which would send the data to diferent files and return the results?? For example, I have one page on which I enter my criteria and when I hit submit it would need to send this data to different php scripts from which one would display the data and second one would display the chart! Quote Link to comment https://forums.phpfreaks.com/topic/118668-solved-submit-button-calling-two-php-scripts/ Share on other sites More sharing options...
mbeals Posted August 7, 2008 Share Posted August 7, 2008 Just write a page to get and pre-process (if needed) the form data, then include the two other pages with include(); Quote Link to comment https://forums.phpfreaks.com/topic/118668-solved-submit-button-calling-two-php-scripts/#findComment-610966 Share on other sites More sharing options...
discomatt Posted August 7, 2008 Share Posted August 7, 2008 Either that, or post to a 'parse' page that uses cURL to duplicate the request to both pages Quote Link to comment https://forums.phpfreaks.com/topic/118668-solved-submit-button-calling-two-php-scripts/#findComment-610975 Share on other sites More sharing options...
budimir Posted August 7, 2008 Author Share Posted August 7, 2008 Can you just make a small example, I'm not sure if I got it right. So basiclly: <form action="somescript.php"> all the code here <submit button here> </from> And i put include for second script into somescript.php???? Quote Link to comment https://forums.phpfreaks.com/topic/118668-solved-submit-button-calling-two-php-scripts/#findComment-610980 Share on other sites More sharing options...
mbeals Posted August 7, 2008 Share Posted August 7, 2008 no, you have the html page with the form on it. Point to actions to another php script. We'll call it dataViewer.php Now, if your two other pages are designed to process form data pulled directly from POST or GET, dataViewer.php would just look like: <?php ## display the data include('data_display.php'); ### display chart include('chart_display.php'); ?> otherwise, you will have to put the code in that formats the form data to the form needed by the scripts before the includes. in this case cURL would be sort of a waste. when you include a file, you basically take everything that is in it and dump in place of the include. So that script, as it is written will execute (in order) data_display.php then chart_display.php as if you had copied the code out of both files and pasted it into one. Quote Link to comment https://forums.phpfreaks.com/topic/118668-solved-submit-button-calling-two-php-scripts/#findComment-611010 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.