dtjxhf595733 2011-05-10 10:44
浏览 44
已采纳

2个具有相同提交的HTML表单 - 通过两者的值进行POST

Ok , maybe a hard one to explain. I have a form that is built using PHP Form Builder Class

Which looks like:

$form = new form("firstForm");
    $form->setAttributes(array(
             "width" => 600,
             "noAutoFocus" => 1,
             "jsIncludesPath" => "lib/php-form-builder-class/includes",
             "action" => "uploader.php"
    ));

    $form->addTextbox("Enter a Title:", 'title' , $row['title']);
    $form->addTextbox("Enter a Promo Code:", "promo" , $row['promo']);
    $form->addWebEditor("Description", "description", $row['description'], array("basic" => 1));
    $form->addWebEditor("Terms and Conditions", "terms", $row['terms'], array("basic" => 1));
    $form->addHidden("img_urls", $row['img_urls']);
    $form->addHidden("destination", $row['destination']);
    $form->addHidden("header", $row['headerimg']);
    $form->addHidden("cmd", "submit_0");
    $form->addButton();
    $form->render();

I want to add some jQuery to one of the elements to allow drag and drop, so I've made another form element:

?>
    <form id="firstForm"  action="uploader.php" method="post" >
    <ul class="sortable"> 
    Mags Select:
    <?
    foreach ($profiles as $mag) {
    ?>
    <div id="sorty"><input type="checkbox" name="units" value="<? echo $mag ?>" /><label><? echo $mag ?></label><br /></div>
    <? }  ?>
    </ul>
    </form>

How can I make the jQuery part post through its values 'units' when the PHP Form Builder Class is submitted?

Ive had a look at adding a method to the class, but wondered if there was an easier way?

EDIT:

The PHP Form Builder Class form is self contained, so wherever the jQuery form is in the page, it will always be outside the other.

  • 写回答

3条回答 默认 最新

  • doutao6330 2011-05-10 10:52
    关注

    You could use javascript and transfer the values from the second form INTO (hidden fields in) the first form?

    Or similarly you could just build the form and copy the HTML (view source) and use that instead of the raw php, then slot your jQuery drag and drop thing into it that way.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导
  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp
  • ¥15 学不会递归,理解不了汉诺塔参数变化
  • ¥15 基于图神经网络的COVID-19药物筛选研究
  • ¥30 软件自定义无线电该怎样使用