简体   繁体   中英

cannot passing value from hidden input form with php

i hava a form , and value of input coming from mysql query , the radio value passing without problem , but hidden input passing only first hidden input on page .

<input type="radio" name="radio" value="<? echo $awardid ; ?>" />
<input type="hidden" name="point" value="<? echo $point ; ?>" />

Note : the Variables in while loop

on html code of form like that , i think the problem is (name of hidden input is a same)

<input type="radio" name="radio" value="1">
<input type="hidden" name="point" value="3">

<input type="radio" name="radio" value="2">
<input type="hidden" name="point" value="5">

<input type="radio" name="radio" value="3">
<input type="hidden" name="point" value="8">

elc ...

you can change the name of the hidden field with point[] . while you request the result you will get all the values of hidden fields in array.

I'm assuming you're trying to simply see the values of your hidden input fields? To do so, do something similar to this:

<input type="hidden" name="point[]" value="3">
<input type="hidden" name="point[]" value="5">
<input type="hidden" name="point[]" value="8">

$post = $_POST['point'];
echo $post[0] ."<br>";
echo $post[1] ."<br>";
echo $post[2];

You'll get the output of

3
5
8

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM