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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2008
    Posts
    106
    Thanks
    27
    Thanked 3 Times in 3 Posts

    Problem with updating INT value, using radiobutton

    Hi all,
    I'm using a form to update the INT value of a sql table field called "frontpage". i use the following code

    Code:
    $updateSQL = sprintf("UPDATE trips SET frontpage=%s WHERE id=%s",
    		       GetSQLValueString($_POST['frontpage'], "int"),
                           GetSQLValueString($_POST['id'], "int"));
    
      mysql_select_db($database_seasons_con, $seasons_con);
      $Result1 = mysql_query($updateSQL, $seasons_con) or die(mysql_error());
    
    
    <label><input type="radio" name="fronpage" value="1" id="fronpage_0" />Yes</label>
    <label><input type="radio" name="fronpage" value="0" id="fronpage_1" />No</label>
    The problem is that the "frontpage" value is always passed as "null" in database which means that the radio button value can't be accessed properly. What am I doing wrong here? Can you help me?
    Last edited by ktsixit; 02-26-2010 at 12:34 PM.

  • #2
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,300
    Thanks
    4
    Thanked 203 Times in 200 Posts
    Your radio button names are missing the T in front, name="fronpage" instead of name="frontpage".
    Dave .... HostMonster for all of your hosting needs

  • #3
    Regular Coder
    Join Date
    Sep 2008
    Posts
    106
    Thanks
    27
    Thanked 3 Times in 3 Posts
    that was stupid, I'm really sorry for this. Sometimes the mistake is in front of your eyes and you go blind. I was trying to fix this yesterday testing a million possible solutions. I feel really stupid.


  •  

    Posting Permissions

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