By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,824 Members | 1,396 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,824 IT Pros & Developers. It's quick & easy.

how to catch a value from radio buttom getting its value from mysql?

P: n/a
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

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
echo?

<input type="radio" name="myname" value="<?php echo $myvalue[3] ?>">

PWT

"gmanon" <gu*********@nyc.rr.com> wrote in message
news:3F**************@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

Jul 17 '05 #2

P: n/a
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" <gu*********@nyc.rr.com> wrote in message
news:3F**************@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



Jul 17 '05 #3

P: n/a
With total disregard for any kind of safety measures gmanon
<gu*********@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.....
Jul 17 '05 #4

P: n/a
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); ?>&nbsp;&nbsp;</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.


Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.