Passing js variable to php in same page

Hi I am using Smart-Wizard jquery plugin. On first step, I have set of radio buttons. Problem is form is not submitted until last step is reached. I want value of raadio button in first step in a php variable. Is there any way to do so?Im not that good at ajax.So far my code is as follows:

function getRadioValue(id) {
var radioBtn = document.getElementById(id);
var v = (radioBtn.value);

Please help me in this regard.

What are you wanting to do in regard to the radio button? Do you currently have a PHP variable that you want to show as a radio button, or are you wanting to send a radio button value to a PHP script?

If it’s the latter, then at any time you can easily send the form via AJAX to a PHP script, using the following jQuery code:

$.post( "test.php", $( "#testform" ).serialize(), function (response) {
    // do something with PHP response

or parts of it:

var content = {};
content[id] = radioBtn.value;
$.post( "test.php", content, function (response) {
    // do something with PHP response

In step 1, I have a list of taxis.In step 3 I want to show “confirm booking” page.For that I need id of radio button selected in step 1.
Something like

"select * from tbl_cabs where cab_id = '".$cab_id."'"

Problem is with $cab_id.If I send it to test.php, how I can retrieve it to my current page?

The best way to do that can be with a hidden form value.

But how can I get hidden value before form submit?

When part 1 submits, you add the id from there as a hidden value to part 2. When part 2 submits you add it’s hidden value for the id to part 3. When part 3 submits you can then use the hidden value for the id.

Yeh.But all steps are wrapped in a single form tag.Can you tell me how I can achieve this?