Issue using $_POST with a textarea

后端 未结 3 1115
难免孤独
难免孤独 2021-01-13 14:08

I have a simple contact form on a website that has 2 text fields, 1 textarea, and 1 hidden field.

For some reason, all the fields POST to a PHP script except the tex

3条回答
  •  终归单人心
    2021-01-13 14:58

    Though in your case you don't have the textarea set to disabled, the reason I found this post was because I wasn't getting a value from a textarea that was. So here's a note for anyone else with that issue.

    To POST the value from a textarea where you want the field to be non-editiable, use readonly instead of disabled - either directly in html or via setAttribute in JavaScript - and then use CSS to highlight it, eg:

    textarea[readonly] {background-color:#F0F0F0;})
    

提交回复
热议问题