I have a multi-part form that give the user the choice of two options for a section of step 2 using form buttons. The option chosen is revealed using jquery. I am trying to pick up on the choice of option using php (and ultimately store it in my database) but it is not picking up the button value at all.
My variables are carried from step to step using sessions with the following code:
// process the $_POST variables and save them in the $_SESSION array
foreach ($_POST as $key => $value) {
// assign to temporary variable and strip whitespace if not an array
$temp = is_array($value) ? $value : trim($value);
// assign to a variable of the same name as $key
$_SESSION[$key] = $temp;
}
?>
I have no issues picking up the values of the other form elements.
The jquery I used is
// script used to hide or show the form for option one
$(document).ready(function() {
$('.optionOneForm').hide();
$('<input type="button" name="ad_option" class="revealer" value="Choose Option 1" />')
.insertBefore('.optionOneForm');
$('.revealer').click(function(){
$('.revealer').hide("medium", "swing");
$('.options').hide("medium", "swing");
$(this).next().fadeIn("slow", "swing");
});
$('.return').click(function() {
$('.optionOneForm').hide();
$('.revealer').show("medium", "swing");
$('.options').show("medium", "swing");
});
});
With minor changes, this is the same code I used for option 2. (In this post I keep getting a button instead of the actual code for the button … ??)
Can anyone see why I can’t get the value of my ‘ad_option’ ?