(03-25-2013, 12:00 PM)The Alchemist Wrote: Spoiler:
Try and learn PHP cURL. I'm showing you a sample script.
Suppose your original form is like this :
Code:
<form name="myWebForm" action="multiple.php" method="post">
<input name="sometext" type="text" />
<input name="pass" type="password" />
<input type="submit" value="SUBMIT" />
</form>
It has two fields, which are textboxes named sometext and pass, your multiple.php has to be like this :
PHP Code:
<?php
if(isset($_POST['sometext'],$_POST['pass']))
{
for($i=1;$i<=2;$i++)
{
$ch = curl_init("http://url.of/action".$i.".php");
curl_setopt($ch, CURLOPT_POST, true); // We'll post data
curl_setopt($ch, CURLOPT_POSTFIELDS, "sometext=".$_POST['sometext']."&pass=".$_POST['pass']); // Two post fields added
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if($execute = curl_exec($ch))
{
echo "Done in action".$i.".php<br />";
}
curl_close($ch);
}
}
?>
Just a little thing that I like to use. Using "isset" is nice, but doesn't really help you a lot. If a paramater is set, it doesn't mean that it has a value.
A URL of:
Code:
www.example.com/index.php?param
Would return true, but could cause some errors in your code, because it has no value.
I prefer to use the function
(
http://php.net/manual/en/function.empty.php), because it actually checks if the value of the variable is TRUE or FALSE. There is a catch though, a request of:
Code:
www.example.com/index.php?param=0
would return FALSE even though it has a value!
To accept 0 as a value, you need to do something like:
PHP Code:
function is_blank($value) {
return empty($value) && !is_numeric($value);
}
(credits go to: steven at nevvix dot com)
I'm posting this, because your curl calls could submit empty values which could cause a chain reaction of errors.