Results 1 to 7 of 7

Thread: Radio Buttons

  1. #1

    Question Radio Buttons


    I have a web page with 4 different Radiobuttons, each with a different value and name, however what I want is say that if you select one the others deselect, i.e. you cant select more than or less than one.

    I know this is possible if you use the same variable names for each combobox but this goes against what I'm trying to acheive with a PHP script.

    Anyone know of a usefull bit of javascript that will do this ?

    for UK Hosting :
    for USA Hosting :

  2. #2
    Well, if you use the same value in the "Name" attribute for each of them, this will accomplish what you want. But is that what are you saying you don't want to have to do?

    If this is going against what you want, then do you mind telling me why, if I knew the situation I'm sure I could give you an answer no problem.

  3. #3
    Basically iam making a php script that processes and handles orders:

    The radio buttons have values of either price/qprice/bprice/yprice depending on how often you want to pay.

    The script then looks for which of these 4 values is set and sets the price to the value of the one that is set.

    I cant really think of any other way of doing it, rather than introducing an additional php page in the middle somewhere, which i'd rather not do.
    for UK Hosting :
    for USA Hosting :

  4. #4
    Ok, that is what I was fishing for. What you are going to want to do is.. and I can't really write it for you without seeing it. But you need to more or less make some If then PHP statements. Such as:

    <form action="process.php" method="post">
    <select name="action">
    <input name="radiobutton" type="radio" value="price">Radio Text Here</input>
    <input name="radiobutton" type="radio" value="qprice">Radio Text Here</input>
    <input name="radiobutton" type="radio" value="bprice">Radio Text Here</input>
    <input name="radiobutton" type="radio" value="yprice">Radio Text Here</input>
    Then, in process.php have something like..

    if($_POST['action'] == 'price')
    elseif($_POST['action'] == 'qprice')
    elseif($_POST['action'] == 'bprice')
    elseif($_POST['action'] == 'yprice')
    // nothing was selected

  5. #5
    Argh, just noticed you said rather than introducing another PHP page somewhere.. sorry heh. :/

  6. #6
    yes - im sure its possible with javascript somehow.

    Also the 3 other prices are worked out from the first price
    for UK Hosting :
    for USA Hosting :

  7. #7
    Ah, I see what you mean now. Sorry for wasting your time.

Posting Permissions

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