douwo5710 2015-01-25 20:44
浏览 18
已采纳

html / php:用php获取列表值

I'm trying to get the value of the li the client clicked on and 'transform' that into a php variable.

<ul class="dropdown-menu" role="menu">
    <li id="banAppeal"><a href="#">Ban Appeal</a></li>
    <li id="banAppeales"><a href="#">Spanish Ban Appeal</a></li>
</ul>

If they click on "Ban Appeal", a form appears:

$(document).ready(function(){
  $("#banAppeal").click(function(){
    $("table#unban").show();
    $("table#default").hide();
  }); });

How can I get the value of whatever they click and put that in a PHP Variable? I know .val() does not work.

  • 写回答

3条回答 默认 最新

  • doushi1510 2015-01-25 20:46
    关注

    To send a variable or a value to PHP, you either need to utilize
    POST
    GET
    AJAX

    here are some example codes in how you can do so.
    http://iviewsource.com/codingtutorials/learning-how-to-use-jquery-ajax-with-php-video-tutorial/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题