RE: Multiple Action Form 03-29-2013, 02:53 AM
#5
(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?paramI prefer to use the function
Code:
empty()Code:
www.example.com/index.php?param=0To accept 0 as a value, you need to do something like:
PHP Code:
function is_blank($value) {
return empty($value) && !is_numeric($value);
}
I'm posting this, because your curl calls could submit empty values which could cause a chain reaction of errors.
Staff will never ever ask you for your personal information.
We know everything about you anyway.
We know everything about you anyway.



![[+]](https://sinister.li/images/modern/collapse_collapsed.png)