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

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-08-2003
gmanon
 
Posts: n/a
Default how to catch a value from radio buttom getting its value from mysql?

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

Reply With Quote
  #2 (permalink)  
Old 11-08-2003
Peter Taurins
 
Posts: n/a
Default Re: how to catch a value from radio buttom getting its value from mysql?

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
>



Reply With Quote
  #3 (permalink)  
Old 11-08-2003
gmanon
 
Posts: n/a
Default Re: how to catch a value from radio buttom getting its value frommysql?

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
>>

>
>
>


Reply With Quote
  #4 (permalink)  
Old 11-08-2003
Phil Roberts
 
Posts: n/a
Default Re: how to catch a value from radio buttom getting its value from mysql?

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.....
Reply With Quote
  #5 (permalink)  
Old 11-09-2003
gmanon
 
Posts: n/a
Default Re: how to catch a value from radio buttom getting its value frommysql?

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.
>




Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:59 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0