문제

On form submission does anything else get submitted but the value? Can I submit the value and the data-group attribute?

 <input type="text" id="theInput" data-group="5" value="the value" />

I'm just talking about a PHP form submission

도움이 되었습니까?

해결책

Only the value gets submitted, but you can add a hidden element for the data-group value. Also note that you should use a name attribute to identify the parameter key:

<input type="text" id="theInput" name="theInput" data-group="5" value="the value" />
<input type="hidden" name="theInputGroup" value="5" />

This will come back to the server with the request parameters of:

  • theInputthe value
  • theInputGroup5

Sidenote: If you are submitting the form via ajax, you can just add the group directly into the parameter list instead of adding a hidden input.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top