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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gmanon

    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

  • Peter Taurins

    #2
    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@ny c.rr.com> wrote in message
    news:3FAC73F3.4 000602@nyc.rr.c om...[color=blue]
    > 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
    >[/color]


    Comment

    • gmanon

      #3
      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:[color=blue]
      > echo?
      >
      > <input type="radio" name="myname" value="<?php echo $myvalue[3] ?>">
      >
      > PWT
      >
      > "gmanon" <guillermina@ny c.rr.com> wrote in message
      > news:3FAC73F3.4 000602@nyc.rr.c om...
      >[color=green]
      >>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
      >>[/color]
      >
      >
      >[/color]

      Comment

      • Phil Roberts

        #4
        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@ny c.rr.com> leapt forth and uttered:
        [color=blue]
        > Yes, I'm using echo. May that be the problem? Should I use
        > print or printf instead?[/color]

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

        Comment

        • gmanon

          #5
          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="tripNumbe r" value="<?php echo $id; ?>">
          <input type="hidden" name="tripDescr iption" value="<?php echo
          $description; ?>">
          <input type="hidden" name="tripPrice " value="<?php echo $price; ?>">

          //VARIABLES FOR OUTPUT

          <td align="center" class="tableIns ide"><?php echo $tripNumber; ?></td>
          <td align="center" class="tableIns ide"><?php echo $tripDescriptio n; ?></td>
          <td align="center" class="tableIns ide"><?php echo $noPassangers; </td>
          <td align="center" class="tableIns ide"><?php printf("$%.2f",
          $tripPrice); ?></td>
          <td class="tableIns ide" align="right">< ?php $subtotal = $tripPrice *
          $noPassangers; printf("$%.2f", $subtotal); ?>&nbsp;&nbsp; </td>

          Guillermina

          [color=blue][color=green]
          >>Yes, I'm using echo. May that be the problem? Should I use
          >>print or printf instead?[/color]
          >
          >
          > He was pointing out that your first example doesn't output the
          > variable at all as you don't use echo or anything else.
          >[/color]



          Comment

          Working...