Well, wouldn't it be easiest to just validate data once, build two mails, and send them? in one file that is.
-r-
Main Topics
Browse All Topicsi have setup a form that collects data.
what i want to do is that after the data is submitted i want it to be processed in one php file and is mailed to the admin and then the same data is processded in some other php file and after prosessing mailed to other account the other account may b of the customer account.
tell me if it is possible:)
thanks in advance
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
if it has to be 2 files that process the same data and each mails the data (or processed results) somewhere, then i would go about it as follows:
1st file receives the submitted data, processes it, emails whatever you want to you, then sends the submitted data to the 2nd file using cURL.
the 2nd file captures & processes the data that the 1st file sent, emails whatever you want to the submitter, then displays something on the screen like 'check your email spanky' or whatever you feel like...
the html file:
<input type=text name=info />
the 1st file:
//get the submitted info
$submitted = $_POST['info']; //obviously needs some validation
//mail it to you
mail("you@you.com", "subject", "sombody submitted this: ".$submitted); //each field should be a variable that was previously processed
//send it to the 2nd file
$url = "http://www.you.com/file2.
$vars = "usersinfo=".$submitted; //you can add more by inserting &'s: userinfo=a&yourinfo=b&myin
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
$returned = curl_exec ($ch);
curl_close ($ch);
echo $returned;
the 2nd file:
//capture the data
$infoFromFile1 = $_POST['usersinfo'];
\\mail it to user
mail("user@user.com", "subject", "message from you.com"); //as variables again
\\let the user know all is good
echo "check your email spanky";
you would probably like to do a little more processing than i've shown here and you have to make sure that cURL is installed and that you have the right mail handler... but thats the essence of my plan.
alternatively, after the 1st processing you could save the data and then call your other php file thru a simple call, eg with a JavaScript redirect.
To pass on the data, you may consider 2 solutions:
- if you are using $_SESSION, you could put the data in there and find them in $_SESSION on the next page (don't forget the session_start() at he beginning of both pages!)
- create in the 1st page a form with hidden fields which will contain your date. you'll the be able to retrieve them in page 2 int $_POST (beware that in that solution you might find some troubles depending on gpc_quotes)
curl is free and you might be able to convince your host to install it
http://curl.haxx.se/
if your host wont install curl, you can try using sockets
http://us2.php.net/manual/
easy socket tutorials:
http://codewalkers.com/tut
http://www.zend.com/zend/s
You can switch from one php page to another in 2 ways:
1 - include php code
include ("page2.php")
would include/insert the corresponding php code (AFTER having checked its syntax - note that even though the pge is included "in the middle of php code", you need to have <?php at start and ?> at end); this would give your php code access to all current variables and data;
2 - link to a page
make a link/ call to a (php) page with some code, after creating a form with hidden fields. the link/ code will be "html output" from your 1st php page. This can be either your current php code that issues a php "header instruction" (see below) -in which case in fact NO html code should have been sent before, or a javascript call. I personnally prefer php.
So page1.php would be
<?php session_start();
//processing
// creating some data, then saving them to $_SESSION
$_SESSION['data1']='someda
....
$_SESSION['dataxxx']='some
header("Location: http://myserver.com/page2.
// be specially careful of any html code (obvious) or any space or blank before the beginning <?php
?>
And page2.php would be
<?php session_start();
$my_data=$_SESSION['data1'
...
$my_data_2= $_SESSION['dataxxx'];
//rest of processing
Business Accounts
Answer for Membership
by: angelIIIPosted on 2005-11-13 at 01:48:33ID: 15282810
Do you know that you can "include " multiple php files for multiple processing?
/
http://us2.php.net/include