1

我希望能够将表格中的信息发布到两个位置。该表单当前发布到一个位置。

<form name="input" action="display.php" method="post">
    search: <input type="text" name="item">
    title: <input type="text" name="title">
    Distance:
    <select type="text" name="distance">
        <option value="5">5 miles</option>
        <option value="10">10 miles</option>
        <option value="15">15 miles</option>
    </select>
</form>

我试过了

<form name="input" action="display.php", "info.php" method="post">

希望它会发布到 display.php 和 info.php 但没有运气。

4

2 回答 2

4

你为什么不用ajax这个。它将帮助您向 2 个不同的页面发送 2 个请求。

$.ajax({
           type: "POST",
           url : "form.php",
           data: {'field1':field1,'field2':field2},
           success: function(msg){
                 // get response here  
               }
           });

$.ajax({
           type: "POST",
           url : "display.php",
           data: {'field1':field1,'field2':field2},
           success: function(msg){
                 // get response here  
               }
           });
于 2013-03-26T13:17:46.597 回答
0

你最好的选择是使用史努比,因为它不会使用 cURL。(你可能有也可能没有,这个类不需要它)。该课程可以在以下位置下载:http: //sourceforge.net/projects/snoopy/ 您需要做的就是包含该课程并将此代码用于多个帖子:

    $snoopy = new Snoopy;

     $submit_url = "url1.php";

     $submit_vars["foo"] = "bar";
     $submit_vars["key"] = "value";
     $submit_vars["input-name"] = "input-value";
     //making sense on what these are?

     $snoopy->submit($submit_url,$submit_vars);
     //additionaly you can print the results with:
     //print $snoopy->results;

     //then move to the next submit url
     //but, remember!  You must instantiate a new class

     $snoopy2 = new Snoopy;


 $submit_url = "url2.php";

 $submit_vars["foo"] = "bar";
 $submit_vars["key"] = "value";
 $submit_vars["input-name"] = "input-value";

 $snoopy2->submit($submit_url,$submit_vars);
于 2013-03-26T13:17:45.237 回答