duangan4406 2016-05-23 15:43
浏览 28

将GET变量作为/ param /传递给MVC PHP

I am currently learning MVC PHP, and have a dropdown menu on my localhost/dashboard/index page (where dashboard is the controller and index is the method).

I understand how to, and have set up my .htaccess to treat additional URL parameters as GET variables, but how do I send form data to those parameters? Let me explain.

A simple dropdown on my page:

<form action="<?=URL?>dashboard/index" method="get">
    <select name="ID" onchange="this.form.submit()">
        <option value="1">ID #1</option>
        <option value="2">ID #2</option>
    </select>
</form>

On submission, this takes me to localhost/dashboard/index/?ID=1, but shouldn't I be writing my URL like localhost/dashboard/index/1?

I can work with that GET within my controller and model no problem, but for conforming to standards, shouldn't it be using the controller/method/param/ format?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大