PHP - Switch case & _GET and Dynamic URL creation

做~自己de王妃 提交于 2019-12-13 03:49:40

问题


What I have in my index page:

    if(isset($_GET['d']) && $_GET['d']!="" ){
        switch ($_GET['d']) {
            case 'singlerequests':
            ViewSingleRequests();
            break;

    }

I have a sidebar menu in which I call cases like index.php?d=singlerequests, this saves me from creating a new php file every link i want to have in the file.

What I want to do: I created a page, in which I am listing multiple rows of date. My data row has multiple columns so instead of showing all data with all columns on that page, I will only have a summary table and a "View More" link next to each row, in which they view the full data on another page. (something like below)

Row Name | View More Link
Row Name | View More Link
Row Name | View More Link

I can retrieve the unique ID for that row in my code but i dont know how I can pass that data(identifier) through above switch case to another function, where i will display all columns of that row to user? If it's not possible that way, how can i do it in a different way?

Thanks.

来源:https://stackoverflow.com/questions/52794890/php-switch-case-get-and-dynamic-url-creation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!