Codeigniter在表格_open上提交表格1表格2

Codeigniter在表格_open上提交表格1表格2,codeigniter,Codeigniter,你知道怎么处理这个问题吗?我的问题是当我在form2上提交时,form1会自动提交到。我想要的是当我在form2上提交时,只有form2提交它。请检查此示例代码 <?php echo form_open('form1'); ?> <input type="text" name="name"> <?php echo form_open('form2'); ?> <input ty

你知道怎么处理这个问题吗?我的问题是当我在form2上提交时,form1会自动提交到。我想要的是当我在form2上提交时,只有form2提交它。请检查此示例代码

<?php echo form_open('form1'); ?>

<input type="text" name="name">


                <?php echo form_open('form2'); ?>
                    <input type="text" name="note">
                        <input type="submit" value="button2"> // this form2 is to insert note on this day
                <?php echo form_close(); ?>

              // then under this form2 we have a table. Table for list of note that all ready insert.          


 <input type="submit" value="button1">  // this form1 is to save all. the "Name" and also the note that we insert it on form2              
<?php echo form_close(); ?>

//本表格2在当天插入注释
//那么在这张表格下我们有一张桌子。表中列出了所有准备插入的注释。
//此表单1用于保存所有。“名称”以及我们在表格2中插入的注释

将嵌套的提交元素更改为

<input type="submit" name="form2_button" value="form2_submit"/>

将一个表单嵌套在另一个表单下不是有效的HTML/XHTML。但是您可以尝试上面的代码。

我认为嵌套表单不是一种好的编程方式。但是在对您的问题进行了一些研究之后,发现了这个链接,它可以对您有所帮助


希望这对你有用。祝你一切顺利

你为什么把你的表格2放在表格1里面?因为在表格2下面我有一张桌子。该表保存在form1下。这就是为什么我需要两张表格。这个问题是可能的,先生?表单2保存在表下。嵌套表单元素不是个好主意。有一些替代方案可以让它发挥作用。但我想大多数时候你都不需要它。你可以发布你的完整代码,我们可以检查它。等等,我编辑了样本代码我有一个问题,但不是一个大问题,先生。
if(isset($_POST["form2_button"]))` or in codeigniter you can input->post('form2_button')