Reputation: 23
I'm writing a php file that can send the same form data to different urls on different servers.
<?php
$urls = array("some_url_num1.php", "some_url_num2.php", "some_url_num3.php");
foreach ($urls as $url) {
echo '<form action="'.$url.'" method="post">
Time From: <br> <input type="text" name="timefrom"><br>
Time to: <br><input type="text" name="timeto"><br>
Password: <br> <input type="password" name="password"><br>
<input type="submit"><br></form>';
}
?>
Currently there are 3 forms on the page, and the user needs to enter the same data (timefrom, timeto, password) three times in order to get the result from some_url_num1.php, some_url_num2.php, some_url_num3.php.
Is there anyway, using php, to let the user enter only once, and get the result from the three .php files?
Upvotes: 0
Views: 126
Reputation: 2512
Create a single form
Collect data in a single php file
From that php file, send user submitted data to other urls using curl
For CURL details you can refer PHP manual
Upvotes: 1