Friday 15 June 2012

html - How do I post the value of multiple answered checkboxes? - PHP -


I have the following code that receives one of the four alternative checkbox answers in a dispute.

Instead of reading the Correpsonding value, my database posts it forever, every time a box is checked for 0 I'm guessing that this key Is it possible to show value here? I tried to replace the place with the value but there was no success.

- My codes are -

PHP:

  foreign currency ($ _ POST ['person'] $ Key = & gt; $ person) {$ _POST ['person'] [$ key] = interval ($ person); } $ Person = implode (',', $ _POST ['person']);   

HTML:

  & lt; Ul class = "ratings" & gt; & Lt; Li & gt; & Lt; Input type = "checkbox" name = "person [1]" value = "excellent" /> < / Li & gt; & Lt; Li & gt; & Lt; Input type = "checkbox" name = "person [2]" value = "good" /> & lt; / Li & gt; & Lt; Li & gt; Input type = "checkbox" name = "person [3]" value = "satisfactory" /> gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Input type = "checkbox" name = "person [4]" value = "poor" /> & lt; / Li & gt; & Lt; / Ul & gt;    

Try it out:

  $ person = implode (',', Array_keys ($ _ POST ['person']));  _POST ['person']  In the array, the keys are  1, 2, 3, 4 , values ​​are  excellent, good, satisfying, poor . In your code, you were calling  intval ()  on prices, which gives  0  for any number.   

No comments:

Post a Comment