简体   繁体   English

使用href链接将值从视图传递到控制器

[英]Passing value from view to controller using a href link

Hi I want to pass data from input value to controller without using a submit button. 嗨,我想不使用提交按钮就将数据从输入值传递到控制器。 I want to use a link to post the form input instead. 我想使用链接发布表单输入。 Is there any way using php only and without javascript or jquery? 有没有办法只使用php而没有javascript或jquery? Thanks. 谢谢。

Short answer to your question is no, but you can easily submit the form using javascript by adding the onclick event handler to the link. 对您的问题的简短回答是“否”,但是您可以通过将onclick事件处理程序添加到链接来轻松地使用javascript提交表单。

try this 尝试这个

<a href="#" onclick="this.form.submit()">Submit</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM