This is a discussion on how to catch a value from radio buttom getting its value from mysql? within the PHP Language forums, part of the PHP Programming Forums category; Hi, this is a newbie question. How can I catch the selected radio value from a form that is feed ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi, this is a newbie question.
How can I catch the selected radio value from a form that is feed by the mysql database? EX.: <input type="radio" name="myname" value="<?php $myvalue[3] ?>"> Value returns the last element of the array $myvalue[3] instead of the selected value. How can I change this? Thanks in advance for any help, Guillermina |
|
|||
|
echo?
<input type="radio" name="myname" value="<?php echo $myvalue[3] ?>"> PWT "gmanon" <guillermina@nyc.rr.com> wrote in message news:3FAC73F3.4000602@nyc.rr.com... > Hi, this is a newbie question. > > How can I catch the selected radio value from a form that is feed by the > mysql database? > > EX.: > <input type="radio" name="myname" value="<?php $myvalue[3] ?>"> > > Value returns the last element of the array $myvalue[3] > instead of the selected value. > > How can I change this? > > Thanks in advance for any help, > > > Guillermina > |
|
|||
|
Yes, I'm using echo. May that be the problem? Should I use print or
printf instead? Guillermina Peter Taurins wrote: > echo? > > <input type="radio" name="myname" value="<?php echo $myvalue[3] ?>"> > > PWT > > "gmanon" <guillermina@nyc.rr.com> wrote in message > news:3FAC73F3.4000602@nyc.rr.com... > >>Hi, this is a newbie question. >> >>How can I catch the selected radio value from a form that is feed by the >>mysql database? >> >>EX.: >> <input type="radio" name="myname" value="<?php $myvalue[3] ?>"> >> >> Value returns the last element of the array $myvalue[3] >> instead of the selected value. >> >> How can I change this? >> >>Thanks in advance for any help, >> >> >>Guillermina >> > > > |
|
|||
|
With total disregard for any kind of safety measures gmanon
<guillermina@nyc.rr.com> leapt forth and uttered: > Yes, I'm using echo. May that be the problem? Should I use > print or printf instead? He was pointing out that your first example doesn't output the variable at all as you don't use echo or anything else. -- There is no signature..... |
|
|||
|
Hi, Here a more detail script.
//VARIABLES FROM DATABASE RESULT $row_array['city'] = $row_items[1]; $row_array['price'] = $row_items[3]; $row_array['description'] = $row_items[4]; $row_array['id'] = $row_items[5]; $id = $row_array[5]; $description = $row_array[4]; $price = $row_array[3]; //HTML CODE FOR RADIO BUTTON if ($j == 1) { $radio = "<input type='radio' name='city' value='" . $row_array[2] . "'>";} else { $radio = "";} //HIDDEN VALUES <input type="hidden" name="tripNumber" value="<?php echo $id; ?>"> <input type="hidden" name="tripDescription" value="<?php echo $description; ?>"> <input type="hidden" name="tripPrice" value="<?php echo $price; ?>"> //VARIABLES FOR OUTPUT <td align="center" class="tableInside"><?php echo $tripNumber; ?></td> <td align="center" class="tableInside"><?php echo $tripDescription; ?></td> <td align="center" class="tableInside"><?php echo $noPassangers; </td> <td align="center" class="tableInside"><?php printf("$%.2f", $tripPrice); ?></td> <td class="tableInside" align="right"><?php $subtotal = $tripPrice * $noPassangers; printf("$%.2f", $subtotal); ?> </td> Guillermina >>Yes, I'm using echo. May that be the problem? Should I use >>print or printf instead? > > > He was pointing out that your first example doesn't output the > variable at all as you don't use echo or anything else. > |