Question

I'm looking to select an item and I want to use this throughout a process, so the selected item needs to be stored somehow. My Next button should make it so I still have the selected item id in step2.php. I was thinking of using a POST or GET, but I was wondering if there are other possibilities using jquery/js, how should I do this? And if it's not possible with jquery, how would I do it in php? The only option I see is using GET.

$(function() {
$("#selectable").selectable({
    selected: function(event, ui) { 
        $(ui.selected).addClass("ui-selected").siblings().removeClass("ui-selected");           
    }                   
});
});

    <ol id="selectable">
        <li class="ui-widget-content" id="1">Item 1</li>
        <li class="ui-widget-content" id="2">Item 2</li>
        <li class="ui-widget-content" id="3">Item 3</li>
        <li class="ui-widget-content" id="4">Item 4</li>
        <li class="ui-widget-content" id="5">Item 5</li>
        <li class="ui-widget-content" id="6">Item 6</li>
        <li class="ui-widget-content" id="7">Item 7</li>
    </ol>
    <a href="step2.php" class="button2">Next</a>

I have created a jsFiddle

Thank you for any help.

Was it helpful?

Solution

could you store the ID in script and pass down in a querystring using the anchor click event?

Something similar to the following maybe..

$('anc_id').click( function() { 
     //code to move to step 2... 
     //something like.... 
     var step2 = 'step2-php?id=' + _ID_ ; 
     ....
     return false; 
 });

note: you need to modify the function above to suit your needs.

regards

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top