Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2006
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    radio button data

    hi!! is there a way to capture the radio button selected into the database??

    for example, 1 radio button is Yes, the other is No. How do i captured and update the table with Yes or No?
    [=cHeRyL=]

  2. #2
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    $array_valid_options = array('Yes''No');
    if (
    in_array($_POST['yourradiobuttonfield'], $array_valid_options){
       
    $sql "UPDATE yourtablename SET yourcolumnname="$_POST['yourradiobuttonfield'] ." WHERE someIDfield="$_SESSION['the_edited_ID'];
       
    mysql_query($sql) or die('Queryproblem updating');
    }else{
       echo 
    'invalid choice';

    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •