将多个单选按钮值发送到控制器Codeigniter

发布于 2025-02-11 13:46:58 字数 1774 浏览 1 评论 0原文

我的调查页面包含

 <table class="table">
 <form action="What should i write here" method="post">
     <?php $numbering = 1;
        foreach ($dataQuestion as $key => $value) : ?>
         <tr>
             <td width="1%"><?= $numbering++; ?></td>
             <td><?= $value->question ?>
                 <div class="form-check mt-1">
                     <input class="form-check-input" type="radio" name="indikator[$value->id]" value="1">
                     Very Good
                     <br>
                     <input class="form-check-input" type="radio" name="indikator[$value->id]" value="2">
                     Good
                     <br>
                     <input class="form-check-input" type="radio" name="indikator[$value->id]" value="3">
                     Decent
                     <br>
                     <input class="form-check-input" type="radio" name="indikator[$value->id]" value="4">
                     Bad
                     <br>
                     <input class="form-check-input" type="radio" name="indikator[$value->id]" value="5">
                     Very Bad
                 </div>
             </td>
         </tr>
     <?php endforeach; ?>
     <tr>
         <td colspan="2"><button type="submit" class="btn btn-info btn-lg btn-block">Submit</button></td>
     </tr>
 </form>

我试图使用&lt; form Action =“”&gt;的每个问题的每个问题的多个问题和广播按钮,但是每个问题都有不同的答案,如何通过&lt; form Action =“”&gt;将所有回答问题的数组发送给我的控制器?

似乎每个人都喜欢使用JavaScript,URL和form_radio()。任何帮助将不胜感激,谢谢。

I have survey page containing multiple question and radio button for each question

 <table class="table">
 <form action="What should i write here" method="post">
     <?php $numbering = 1;
        foreach ($dataQuestion as $key => $value) : ?>
         <tr>
             <td width="1%"><?= $numbering++; ?></td>
             <td><?= $value->question ?>
                 <div class="form-check mt-1">
                     <input class="form-check-input" type="radio" name="indikator[$value->id]" value="1">
                     Very Good
                     <br>
                     <input class="form-check-input" type="radio" name="indikator[$value->id]" value="2">
                     Good
                     <br>
                     <input class="form-check-input" type="radio" name="indikator[$value->id]" value="3">
                     Decent
                     <br>
                     <input class="form-check-input" type="radio" name="indikator[$value->id]" value="4">
                     Bad
                     <br>
                     <input class="form-check-input" type="radio" name="indikator[$value->id]" value="5">
                     Very Bad
                 </div>
             </td>
         </tr>
     <?php endforeach; ?>
     <tr>
         <td colspan="2"><button type="submit" class="btn btn-info btn-lg btn-block">Submit</button></td>
     </tr>
 </form>

I'm trying to pass selected radio button value to my controller file using <form action=""> but every question have different answer, how to send array of all answered question to my controller via <form action=""> ?

It seems everyone prefer to use javascript, url, and form_radio(). Any help would be appreciated, thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

锦上情书 2025-02-18 13:46:58

&lt; form action =“我应该在这里写什么...&gt;


在那写入路由/路径,旨在接收您的http post请求。 IE:

<form action="/survey" method="post">

状态一个路由定义,旨在接收app \ config \ doutes.php中的路由。 IE:

// ...
$routes->post("/survey", "SurveyController::create");

<form action="What should i write here" ...>


Write there the route/path meant to receive your HTTP POST request. I.e:

<form action="/survey" method="post">

The state a route definition meant to receive the route in app\Config\Routes.php. I.e:

// ...
$routes->post("/survey", "SurveyController::create");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文