dougao2830 2016-07-16 07:28
浏览 22
已采纳

form_open无法在codeigniter控制器内部工作

I want to echo a form inside controller. In that i wrote echo form_open, but it is not working. Here is my code inside controller function

 echo '<button class="btn btn-primary" data-toggle="modal" style="background-color:#428bca;"  data-target="#myModal" ></button>';

                            echo '<div class="modal fade bs-example-modal-sm" tabindex="-1"  id="myModal"  role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">';
                              echo '<div class="modal-dialog modal-sm">';
                                echo '<div class="modal-content">';
                                   echo ' <div class="modal-header">';
                                        echo '<button aria-hidden="true" data-dismiss="modal"  class="close" type="button">&times;</button>';
                                        echo '<h4> Do you </h4>';?>

                                        <?php echo  form_open('amt_controller/add_amount/'.$schoolID."/".$stID);

                                          echo '<input type="name" class="form-control"  name="Amount" id="Amount" placeholder="Enter the amount">';

                                        echo '</div>';
                                      echo '<div class="modal-body">';
                                        echo '<button class="btn btn-primary" style="margin-left:65px;background-color:#428bca;">Submit</button>';?>
                                             <?php echo form_close();
                                       echo '<button type="button" class="btn btn-default" data-dismiss="modal">No</button>';
                                echo '</div>';
                                echo '</div>';
                              echo '</div>';
                            echo '</div>';
  • 写回答

1条回答 默认 最新

  • dtmsaqtly798322992 2016-07-16 08:24
    关注

    Remove the php tags on form open and close and put them like

    <?php
    
    echo '<button class="btn btn-primary" data-toggle="modal" style="background-color:#428bca;"  data-target="#myModal" ></button>';
    
    echo '<div class="modal fade bs-example-modal-sm" tabindex="-1"  id="myModal"  role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">';
    echo '<div class="modal-dialog modal-sm">';
    echo '<div class="modal-content">';
    echo ' <div class="modal-header">';
    echo '<button aria-hidden="true" data-dismiss="modal"  class="close" type="button">&times;</button>';
    echo '<h4> Do you </h4>';?>
    
    form_open('amt_controller/add_amount/'.$schoolID."/".$stID);
    
    echo '<input type="name" class="form-control"  name="Amount" id="Amount" placeholder="Enter the amount">';
    
    echo '</div>';
    echo '<div class="modal-body">';
    echo '<button class="btn btn-primary" style="margin-left:65px;background-color:#428bca;">Submit</button>';?>
    
    echo form_close();
    
    echo '<button type="button" class="btn btn-default" data-dismiss="modal">No</button>';
    echo '</div>';
    echo '</div>';
    echo '</div>';
    echo '</div>';
    
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀