简体   繁体   中英

How to make sure that user has clicked on textarea using php

我知道我们可以检查是否在php中单击了按钮,但是有什么方法可以不使用jquery或Javascript而仅在php中检查textarea是否集中在php中

PHP runs on the server, it has no knowledge of what's happening in the client's browser. The only reason you can check if a button has been clicked is because when the browser sends the form data to the server, it includes the name of the button that was clicked. Also note that this only works on buttons that actually trigger a form submission, you can't detect any old button press with PHP.

Since focusing on a textarea doesn't submit anything to the server, no PHP code is even run, so there isn't any way to do what you want. Javascript is the only solution, since it runs in the client's browser, not on the server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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