Option buttons w / multiple values in a PHP form

Hello

I have a registration form in line with several options that each have their own prices.  I want the form results to display the name of each option, the user selects, and the total of all the combined prices.  My question is how can I do when each option button only allows you to attach a value?  Is there a way to retrieve the name of the option and the price in the form of two distinct values somehow?

< input name = "option" type = "radio" value = "Cotton - $10" / >

< input name = "option" type = "radio" value = "Sweden - $15" / >

< input name = "option" type = "radio" value = "- black - leather $20" / > "

< input name = "option" type = "radio" value = "- White - Leather $20" / > "

For example, if they choose "- black - leather $20" I want to be able to retrieve a value of 'Leather - black' and another from 20:00 ' ' (to be added to the total price) rather than simply 'leather - black - $20' into a single value.

Any help would be greatly appreciated!  I only had to deal with a single value for each option button in the past.

Thank you!

Paul

Yes you can do it.  If I were you I would eliminate the space in the value just to eliminate confusion.  Then when you treat the variable use the Explode ( http://php.net/manual/en/function.explode.php ) function to separate the values in your channel.  So if you eliminate the space your code would look like:

$_POST ['option'] = $option;

$option = explode (""-", $option");

print $option [0]; This would print material

print $option [1]; It would print the price

The only thing is that your first two options is not a color.  If your berries would be different.  To compensate for this, I recommend you to use the same format for all the options and make a kind of null value, if nothing will be added for a single value in the table, IE: color.

Tags: Dreamweaver

Similar Questions

  • Option button setting the value of digital field display

    I have a Radio button with two elements, if the first button is selected, and then the numeric field should display as a monetary value ($x, xxx.xx) but if the second button is selected the numeric field should show as General numbers (x, xxx) with no decimal point.

    Any help would be greatly appreciated.

    Hello

    You can change the display model at run time, but it requires a bit of scripting.

    There is an example here: http://assure.ly/hVcqlj, if you have a look at the radio buttons on page 2. There is script in the click event that should help you.

    Hope that helps,

    Niall

    Ensure the dynamics

  • display of the values of selected option buttons

    Hello

    It is an application that would allow users to go through a step-by-step process to build their product, in this case, it's ice cream.


    Description:

    There are six option buttons, four belonging to a radiobuttongroup and two others belonging to an another radiobuttongroup. In addition, there is a mx:TextArea (including the editable value false).

    This Panel will most likely go into a mx:ViewStack as a "first step" in the process of personalization of the ice cream. The selection of a radiobutton to every radiobuttongroup must be required to move forward (go to the next "step", as in the Panel following in the ViewStack).

    Problem:

    Allowing the user to select an item in each of the two radiobuttongroups and write values of these two selected radiobutton [such as specified by the value of the radiobutton = property 'radioButtonValue'] to the mx:TextArea, on different lines.

    I have been moderately successful in trying to do it, but I didn't know how to write two values in the same text box
    without crushing them each other.

    Misc.

    At first, I tried something to the effect of: ( changed from the 2 flex components Explorer)

    < mx:Script >
    <! [CDATA]

    Import mx.events.ItemClickEvent;

    Event handler function to display the selected button
    in a text box.
    private void handleConeType(event:ItemClickEvent):void
    {
    If (event.currentTarget.selectedValue is "sugarCone")
    {
    iceConeTextBox.text = "Sugar cône";
    }
    on the other
    {
    If (event.currentTarget.selectedValue is "waferCone")
    {
    iceConeTextbox.text = 'Wafer cone. "
    }
    }
    }
    }
    []] >
    < / mx:Script >
    Quite exaggerated to get something to work, I know. It was not very effective, and I sincerely hope that there are better ways to do this.

    I would like if possible avoid using two mx:textareas.

    Example of

    Here is a link to better describe what I'm talking about (Note: View Source is enabled).

    ConeChooser Application


    Thank you!

    You can access the selected radio button value the id of Group of radio button groups, you don't need to check each radio button individually. Then coneType.selectedValue will give you the value of a button radio is selected in the group, and the coneType.selection.label will give you the label of the currently selected option button or null if none is selected.

    Try this code:


    http://www.Adobe.com/2006/mxml '.
    Width = "100%" height = "100%" layout = "absolute" >

    private function updateText (): void {}
    var totalSelected:uint = 0;
    var cone: String = "";
    var size: String = "";
    If (coneType.selectedValue! = null) {}
    Cone = coneType.selection.label;
    totalSelected ++;
    }
    If (coneSize.selectedValue! = null) {}
    size = coneSize.selection.label;
    totalSelected ++;
    }
    iceConeTextBox.text = '\r', cone + size;
    If (totalSelected == 2) {}
    next_btn.enabled = true; to go to the next view in the viewstack
    }
    }
    ]]>

    horizontalCenter = red "0.5" = "0.5" layout = "absolute" >

    text = "Select your cone." y = "10" height = "44" fontSize = "25" horizontalCenter = "0" / >



    label = "Sugar Cone" width = "150" x = "2" y = "62" / >

    label = "Waffle Cone' width = '150' x '2' = y ="88"/ >

    label = 'Wafer cône' width = '150' x '2' = y = "114" / >

    label = "Chocolate dipped Wafer cone" width = "201" x = "2" y = "140" / >






    Vygo

  • Setting a value of option button using Javascript

    After much research, I realized that the appropriate command to get the value of a radio button in JavaScript of the APEX is 'html_RadioValue', but I was not able to understand a command that will allow you to that you set the value of the option button. Is there a documentation on the use of the APEX of the JavaScript which covers this issue?

    Here is a simplified version of the script:


    < script language = "JavaScript" type = "text/javascript" >
    function showval()
    {
    var item1 = html_RadioValue ('P19_RADIO');
    Alert (Item1);

    Invert the current selection
    If (item1 == 'Y') then
    {
    < mystery_statement > //set P19_RADIO n.
    }
    on the other
    {
    < mystery_statement > P19_RADIO //set to Y.
    }
    }
    < /script >


    I tried the following, but none of them have worked:

    -document.getElementById ("P19_RADIO") .value = 'n';
    -document.getElementById ("P19_RADIO") .checked = 'n';
    -$x('P19_RADIO').value = 'n';
    -$x('P19_RADIO').checked = 'n';


    Thank you.

    Chris:

    - document.getElementById("P19_RADIO_0").checked = true; // should work. '0' is the index of the first item in the radio group
    

    3.1.2 APEX Javascript APIs are documented here

    http://download.Oracle.com/docs/CD/E10513_01/doc/apirefs.310/e12855/javascript_api.htm#CDEEIGFH

    CITY

  • Radio button in the PHP form

    Hello

    I would like to change an existing list to a radio on my pho form option.
    http://Opie.monkeyshrine.com/contact/contactus.php

    Of this

    < select name = "reason" = value "<?" PHP if (isset($_POST['reason'])) echo htmlentities($_POST['reason']);? ">" tabindex = "4" size = "1" id = "right" >
    < option selected > tell us why < / option >
    < option value = "Beijing to Moscow" > Beijing in Moscow < / option >
    < option value = "Moscow to Beijing" > Moscow to Beijing < / option >
    < option value = "Vladivostok to Moscow" > Vladivostok to Moscow < / option >
    < option value = "Beijing in Beijing" > Beijing in Beijing < / option >
    < option value = 'Only Mongolia' > only Mongolia < / option >
    < option value = "Options Direct Tranzip" > Options Direct Tranzip < / option >
    < option value = "Another reason" > another reason < / option >
    < / select >

    TO

    < input type = "radio" name = 'trip' value = "<?" PHP if (isset($_POST['BM'])) echo htmlentities($_POST['BM']);? ">" / > Beijing in Moscow < / label >
    < br / >
    < label >
    < input type = "radio" name = 'trip' value = "<?" PHP if (isset($_POST['VM'])) echo htmlentities($_POST['VM']);? ">" / > Vladivostok to Moscow < / label >
    < br / >
    < label >
    < input type = "radio" name = 'trip' value = "<?" PHP if (isset($_POST['MB'])) echo htmlentities($_POST['MB']);? ">" / > Moscow to Beijing < / label >
    < br / >
    < label >
    < input type = "radio" name = 'trip' value = "<?" PHP if (isset($_POST['BB'])) echo htmlentities($_POST['BB']);? ">" / > In Beijing Beijing < / label >
    < br / >
    < label >
    < input type = "radio" name = 'trip' value = "<?" PHP if (isset($_POST['Mongolia'])) echo htmlentities($_POST['Mongolia']);? ">" / > Mongolia only < / label >
    < br / >
    < label >
    < input type = "radio" name = 'trip' value = "<?" PHP if (isset($_POST['Direct'])) echo htmlentities($_POST['Direct']);? ">" / > Options Direct Tranzip < / label >
    < br / >
    < label >
    < input type = "radio" name = 'trip' value = "<?" PHP if (isset($_POST['unsure'])) echo htmlentities($_POST['unsure']);? ">" / >
    Not sure

    except, that I made the wrong group radio and is not insert anything on the answer.

    This is the postal code for php

    $Indhold. = "Type of trip:". " $_POST ['journey']. » \n » ;
    $Indhold. = « \r » ;
    $Indhold. = "why:". " $_POST ['reason']. » \n » ;
    $Indhold. = « \r » ;

    Please help me correct the radio button group.
    Thank you.

    PS. can you also confirm that the local time display your local time?

    yesmaybe wrote:
    >Beijing-
    > Moscow

    This will be only to insert a value in the option button if the form has
    already been submitted * and * $_POST ['BM'] contains a value. You do not have
    need a PHP code in the radio group itself unless you do
    validation server side of the form. It must be:

    Or that (if you validate on the server side):

    --
    David powers
    Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    http://foundationphp.com/

  • expand option buttons

    Is it possible to enlarge the round buttons on a remote control?  It is quite easy to customize a control/led.

    Are you talking about only one option button or radio button control?

    A radiobutton control is a container for Boolean values , where only one (or perhaps zero if so configured) may be true at some point. On the diagram, it acts as an enumeration with the label of each control as elements.

    You can with the right button of the Boolean values inside and replace them with any other boolean you like (buttons, switches, LEDS, etc.etc). You can remove Boolean values and add more boolean. They don't even have to have the same design. Some Boolean place you want and resize them to any desired size!

    Now to create an oversized radiobutton (be it inside of a radiobutton control or autonomous), you can import graphical States of a button Boolean true and false if it looks like a giant readiobutton. Everything can be done!

    (The only problem is the fact that the radio button control cannot be empty, even on a temporary basis during editing. It seems that no one cares really, because my related idea is not very popular )

  • control of option buttons

    Buttons radio programmatically controllable?

    If x is the X radio button is selected, if there happens then y radio button is selected.

    This would happen automatically in the VI.

    Thank you

    As noted, the link provides the General method for controls. Specifically to the option button: the data type of a radio button is essentially an enum. You can simply plug an integer value to indicate that you want selected, or better yet, typedef control radio button and then you can use the enum directly on the chart values, providing the self-documentation.

  • JavaScript app.alert option button

    I have a pdf form that has required text fields, and radio buttons. Once the user has filled out the form, I created a button that will check to see if all required fields have been filled, if yes then send an email and then close the form without saving changes. If not, an alert app appears and allows you to complete the missing information. The app.alert works with text fields, but not radio buttons. If the option button is the only thing not filled, I get the default error and then he jumps the electronic part and closes without saving the pdf file. I have a set of radio buttons (Qty 3) called 'group '. Here's the JavaScript code. Can someone please.

    var requiredFields = new Array();

    for (var i = 0; i < this.numFields; i ++)

    {

    fName = this.getNthFieldName (i) var;

    var f = this.getField (fName);

    If (f.type! = "button" & & .required this.getField (fName) & & (this.getField (fName) .value == null | this.getField (fName) .value == ")")

    {

    requiredFields [requiredFields.length] = fName ;}}

    var error = "Please fill in the following fields: \n\n";

    for (j = 0; j < requiredFields.length; j ++)

    {

    If (requiredFields [j] .value is nothing)

    {

    Error = error + requiredFields [j] + "\n";

    F2 var = this.getField (requiredFields [j]);

    F2. SetFocus();

    }

    }

    If (requiredFields.length > 0) {}

    App.Alert (Error);

    } else {}

    this.submitForm ({}

    cURL: "mailto: " [email protected] ", "

    cSubmitAs: "PDF."

    })

    this.closeDoc (true);

    }

    The default value of a group of radio buttons when no key is selected is 'Off', not null.

  • How to use an option button in the report of the IR to redirect itself to view another report

    IHH team, I have a requirement where I have an IR report option button. By clicking this radio button, another report appears under the main report with few other details of the selected item. The idea was to have a zoom of report as seen in the Group of MS Excel.  However, I am stuck because I don't want the user to press the "submit" button each time after selection of a radio button. I want the result to Report2 to change on the selection radio button in report 1.

    Please notify.

    Kind regards

    Samar

    for example

    Report1 details

    RB col_id text1 text2 Text3

    1 . abc erd 45

    2 ghj dfgrt 67

    Suppose the user selects the first option button, the page displays another report with details below the main report

    Report1 details

    col1_id text1 text2 Text3

    RB1 1 abc erd 45

    2 RB2 ghj dfgrt 67

    Report2 details

    col1_id col2_id text1 text2 Text3

    1 11 ihj pkpk 78

    1 23 ljl kpk 45

    user6255521 wrote:

    Please update your forum profile with a real handle instead of 'user6255521': Video tutorial how to change username available

    When asking a question, always include the information referred to in these guidelines: How to get the answers from the forum

    I was able to achieve using the linl. I created a link on the col_id and it redirected to itself after you set the value of col2_id. I also changed the style of the button link and so col1_id looks like a button.

    However, I was interested to know if we can achieve this with a radio button and use the update form the Report2.

    You mean like this? It is very simple to implement using dynamic measurements.

    1. Add a column of radio group to the main report:

    select
        apex_item.radiogroup(1, d.department_id) rbg
      , d.*
    from
        oehr_departments d
    

    APEX 5.0, apply a static ID "rbg" to the column of radio group.

    2. create a hidden page unprotected element to maintain the value of the selected radio button to use as a filter in the detailed report. In the example, it is P31_DEPARTMENT_ID.

    3 refer to the element of filter in the WHERE clause of the report detail:

    select
        *
    from
        oehr_employees
    where
        department_id = :p31_department_id
    

    Set the Items property of the Page to send in the definition of report P31_DEPARTMENT_IDretail area.

    4. create a dynamic action of change on the Group of radio buttons:

    Event: Change

    Selection type: jQuery Selector

    jQuery Selector:td[headers="rbg"] input[type="radio"]

    Real Actions

    Seq: 10

    Action: Set value

    Type of value: Expression of JavaScript

    JavaScript expression:$(this.triggeringElement).val()

    Selection type: Article (s)

    Point: P31_DEPARTMENT_ID

    Seq: 20

    Action: Discount

    Selection type: Region

    Region:

    The best way to get help with something like that is for you to reproduce the problem with an example on apex.oracle.com. Set up as much as you can before posting here and when you post the question, share identification information of developer comments for the workspace so that we can see the example and work the solution directly.

  • Dynamic stamp with several entries of option buttons to fill in the box!

    I try the code to get a stamp with the multiple entry below. Based on the selection of option buttons, I need the patch update. I can't find the error. Can anyone help pl.

    OK, that's fine.

    I think the problem is that you have set the dialog object after the code where you are calling it. You must move the definition of DiaBox to the top of the code.

  • I have 3 radio button options to choose, but I want only a certain one for calculating sales tax. How can I assign a calculation to an option button?

    I have 3 radio button options to choose, but I want only a certain one for calculating sales tax. How can I assign a calculation to an option button?

    Ok. Let's say the name of the radio button group is "Radio1", the value of exports in this field is '3', the name of the subtotal is "Subtotal" and tax rate is 16%. You can use this code as the custom calculation of the tax field script:

    Event.Value = (this.getField("Radio1").valueAsString == "3")? Number (this.getField("Subtotal").valueAsString) * 0.16: 0;

  • Cannot find the display in Code view Options button

    Hello

    To set the appearance of value encoding preferences in Dreamweaver code

    He said ""click the view Options button in the toolbar at the top of the Code view or the Code Inspector. " "

    However, I can't find it. If I click on Live, then I find it. But do not include the options Word Wrap, line numbers

    I'm wrong with something?

    The instructions are correct for the Code Inspector, but not for the document Code discovered.

    You can find options for Code view under view > Code view options.

    Some of these options are also available on the Code view toolbar, which can be activated from view > toolbars > coding.

  • Passing multiple values at the request of the State (no status page)

    Hello

    [APEX 4.2.4.00.08 on the 11.2.0.3 database]

    I didn't know how to explain briefly what I need in the title of the discussion, that's why I added the song "(non page rapport)". "  I met a lot of threads associated with passing of selections multiple values from one page to another, or via a URL from one page to another.  I know how to do this.  The problem I have right now is trying to pass the commas of the values contained in an application to a report query element.  Here's where the "(rapport non page) ' comes into play."  I refer to the report query at the level of the application (i.e. shared components-> report queries).  I wish really it had another name for it.  "Report on the application of queries", perhaps?

    In any case, my report query has a bind variable, AI_ID_NUMBERS, that is defined correctly in the shared-> components report queries. However, when this item application has multiple values such that AI_ID_NUMBERS = 4, 5, 6, 7 etc., my URL looks like this:

    myapexsite.com/f? p = 456:2:1234567890:PRINT_REPORT = report_1:AI_ID_NUMBERS:4, 5, 6, 7

    So, this returns only one record for the report where the identification number is 4, one.  I tried a string parameter of Substitution of Application (URL_REPORT_1) with the two following variants (for which both return only a single record):

    Substitution string = URL_REPORT_1 and Substitution value = f? p = & APP_ID.:0 : & SESSION. : PRINT_REPORT = report_1:AI_ID_NUMBERS: & AI_ID_NUMBERS.

    Substitution string = URL_REPORT_1 and Substitution value = f? p = & APP_ID.:0 : & SESSION. : PRINT_REPORT = report_1:AI_ID_NUMBERS:-& AI_ID_NUMBERS. \

    returns...

    myapexsite.com/f? p = 456:2:1234567890:PRINT_REPORT = report_1:AI_ID_NUMBERS:4, 5, 6, 7

    myapexsite.com/f?p=456:2:1234567890:PRINT_REPORT=report_1:::AI_ID_NUMBERS:\4,5,6,7\

    .. .respectively

    I really thought that the backslashes would have solved the problem.  Any ideas why my report request (PDF) returns only one line?

    Thank you

    -Seth.

    Well, too bad. I realized the mistake I did.

    When you work with 'request report queries', there is an option to include variable bind, for example the application or page elements.  I had already done that, but for some reason, thought that I also had to pass the parameter and its values in the URL.  This is not necessary since the report query query already has the issue of the application/page related to it.  The following URL works fine:

    myapexsite.com/f? p = 456:2:1234567890:PRINT_REPORT = report_1

    And, Yes, it's the URL that is provided when you set up a "application report query.  I was thinking too hard.

    -Seth.

  • Pulling data from a selection of the option button to use in the field

    I have a radio with 9 options button (1 000, 2 000, 3 000... 9 000). It's a form of insurance, and I can't change to a drop down or fill-in, etc..  I need a later field in the form to the number they chose in the option box.  For example, if some select 3rd in the series of radio (3,000) button I want Field2 fill-in auto number 3 000.

    Is it possible to do an if / then statement to extract data from the radio button option?  I could do this in Excel but don't have a clue how to do here.  And I don't know about Java.  :-(

    Any help would be appreciated!

    Carol

    You can try this custom script that another user here suggested to me

    You click on properties > Calculate > custom calculation Script > change

    Then paste this in...

    var v = this.getField("Name_of_Radio_button_grouping").value;

    If (v == "1000") event.value = "1000";

    else if (v == "2000") event.value = "2000";

    else if (v == "3000") event.value = "3000";

    else if (v == "4000") event.value = "4000";

    else if (v == "5000") event.value = "5000";

    else if (v == "6000") event.value = "6000";

    else if (v == "7000") event.value = "7000".

    else if (v == "8000") event.value = "8000".

    else if (v == "9000") event.value = "9000".

    etc.

    else event.value = "";

  • Good way to group rows of option buttons?

    I'm trying to fix a problem of menu on a plugin open source. Radio buttons were not put into groups then when an option button is selected, all the others disappear - even if the selections are always saved.

    cr2hdr_Lightroom_plugin_GUI_before.jpg

    I've grouped each line and that resolved the question of the selection, but the appearance is not fair. Note that there is now a darker background on each line and the spacing has increased while the options are no longer fit in the space.

    cr2hdr_Lightroom_plugin_GUI_after.jpg

    I looked through the code looking for something that could be put in the background, but can't find anything. What should I look for?

    I do not completely understand the intricacies of option buttons, but do not ensure that each set of buttons is in a separate container.  The SDK guide says:

    Inside a container, only a set of option buttons should be selected. By selecting a button should deselect all others in the game. You need to apply this way that you bind the values button. It is not automatic.

    In addition, the reference LR 6 SDK API said there is a difference between the behavior on Mac and Windows, which may explain the different behavior that you see:

    Since the 6.0 release of Lightroom SDK, on Mac only, radio buttons with the same parent view will be automatically 'bound', i.e. checking you will erase all the others, due to changes in the underlying operating system provided API. This should be noticeable in a construction of view where radio buttons are declared via the osFactory:row or osFactory:column method within the same parent view. If you want to have more than two radio buttons in a row or a column, use the osFactory:view method instead, with a place attribute from horizontal or vertical . Do not try to take advantage of the automatic behavior of OS x, because automatically modified radio button States will not necessarily be reflected in the table of properties that bind the values of radio buttons.

    This suggests also put each set of radio buttons in an osFactory container: view (), with a property of 'place '.

Maybe you are looking for

  • Where can I get the keys that fell from my macbook air keyboard?

    Where can I get the keys that fell from my macbook air keyboard?

  • I want to install WIN XP PRO on Satellite U300-111

    Hi all someone has an idea how to get driver RAID Serial ATA controller for toshiba Satellite U300-111 to install windows xp pro because it shows me a messege when I press on enter to install, he said: Installation of Windows XP Professional Setup co

  • iPhoto App does not open on Mac Mini

    Cannot open iPhoto on my Mac Mini running OS X El Capitan 10.11.2 The application on the dock has the reduced/white circle above the icon, as saying: "not available". When I click on iPhoto, I get this message: "the version of iPhoto installed on the

  • Families sharing-apps/photos

    I just put new iPhone 5 s my son for family sharing.  I want to him to have access to the music, apps and images.  So far, there is no evidence for him.  We have different iCloud accounts that I don't want him to have access to everything I do but so

  • Module AO trigger using PFI on the cDAQ-9188

    I use a cDAQ-9188 chassis with an AO (NOR-9264) module.  Is it possible to configure a PFI (channel on the frame) as an input signal to synchronize an AO channel with the trigger?  Here's what I'm trying to do.  I need a channel on the AO module to s