POST extra values in an HTML <form>

前端 未结 3 1702
臣服心动
臣服心动 2020-12-19 03:32

I have a simple form which passes the value of an element:

相关标签:
3条回答
  • 2020-12-19 03:50

    You can simply use a hidden field. Like so:

    <input type="hidden" name="your-field-name" value="your-field-value" />
    

    This field will then be available in your PHP script as $_POST['your-field-name']

    0 讨论(0)
  • 2020-12-19 03:57

    As mentioned already, using hidden input fields is an option, but you can also use a session. That way you don´t have to post anything, the variables remain on the server and are not exposed in the html.

    0 讨论(0)
  • 2020-12-19 03:59

    You can include a hidden form element.

    <input type="hidden" name="foo" value="bar" />
    
    0 讨论(0)
提交回复
热议问题