How can an id of input field can be read by PHP?

2019-01-19 08:51发布

I have an HTML input field, and I have every input field specified with some id, now how can I use this input field id to identify the field.

Example:

<input type='text' id='float' name='attributename' value='' maxlength='30'/>

I need to verify the id of input field for float and then insert the input field's value in to db in particular field.

Please help me out..

标签: php html input
7条回答
Fickle 薄情
2楼-- · 2019-01-19 09:23

Yes, deceze put it best.

Basically, everything in PHP (and all of web programming) requires key = value pairs. So, if you have no key, you in turn have no value. If the form element has only an ID and no NAME, then the variable that is passed to PHP will not exist.

The best way to test, is to have your HTML form element test with a "GET" instead of a "POST", this way, you will see the key=value pairs in the address bar when the form is submitted to the method by the action. All then you must do is use $_GET instead of $_POST to pull the variables.

查看更多
登录 后发表回答