Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8

Thread: Radio Buttons

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    9
    Member #
    15621
    how do i get information from a radio button for example
    o Single
    o Married
    how do i make that when i check single and press submit it will go in to my database by the way im using SQL... or even just how do i make when i check and press submit the next page would display the item chosen:bandit:

  2.  

  3. #2
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Give all the radio buttons you want to be in the same `group' the same [minicode]name[/minicode] attribute. Then, the one that's selected is the one that will be submitted, and they will behave mutually exclusively.

    I'm moving this out of Javascript, as it's actually an HTML question.

  4. #3
    Senior Member
    Join Date
    Apr 2005
    Location
    Hatfield, England
    Posts
    855
    Member #
    9790
    Shadowfiend it sounds more like a php or asp question.

    Dragon_EPT you need to process the form with php when use a database query to update the database. If I have time later I will give you the code to do it in php

  5. #4
    Senior Member -chris-'s Avatar
    Join Date
    Apr 2006
    Location
    SK
    Posts
    1,205
    Member #
    13102
    I think it's a bit of both, actually, with Shadowfiend's answer being the first half of what he needed to hear. The last part of the solution would be the PHP or ASP bit, that you have offered to help with.
    Portfolio | Blog | Twitter

    Was my post, or someone elses, helpful? Click the thumbs up to let everyone know!

  6. #5
    Junior Member
    Join Date
    Aug 2007
    Posts
    9
    Member #
    15621
    do you guys have sample codes? i would understand it in terms of codes. thanks.!

  7. #6
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    HTML:

    HTML Code:
    <form action="process.php" method="POST">
    <input type="radio" name="choices" value="choice1" />
    <input type="radio" name="choices" value="choice2" />
    <input type="submit" />
    </form>
    And if you use PHP, it's as simple as using the name parameter...

    PHP Code:
    $radio_option $_POST['choices']; // Will be filled with "choice1" or "choice2" or "" (if empty) 
    Actually, radio buttons are just like text fields, only that they have a certain set of text to pick from.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  8. #7
    Junior Member
    Join Date
    Aug 2007
    Posts
    9
    Member #
    15621
    but how do you get the value? for example after i click submit how will i make that the one i chose will be displayed in the next page?

  9. #8
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    That's what the PHP code Steax posted was for. What are you using on the server side to get these values?


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:53 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com