on page 1, I try to pass some parameters through a url to page2.
I want to fire up page2 and select the options as if i selected them on page2.
How can I pass #divOptionToTake, #divSelectChannel_btnSubmit, #selected_channel_new, #selChannels, #frmSelectChannel from page 1 and get it executed? Thanks.
Page1
…../page2.php?selected_channel=facebook&option_to_take
Page 2
<html>
<script type="text/javascript">
$(document).ready(function() {
<?php if($option_to_take == ""){ ?>
$.blockUI({ message: $('#divOptionToTake'), css: { width: '420px' } });
<?php } ?>
// SELECT CHANNEL
$('#divSelectChannel_btnSubmit').click(function() {
$.unblockUI();
$('#selected_channel_new').val($('#selChannels').val())
$('#frmSelectChannel').submit();
//return true;
});
});
</script>
</html>
The code of the form is here.
<form name="frmSelectChannel" id="frmSelectChannel" action="" method="POST">
<input type="hidden" name="task" value="select_channel" />
<input type="hidden" name="option_to_take" value="new campaign" />
<input type="hidden" name="selected_channel" id="selected_channel_new" value="facebook" />
<div id='divSelectChannel'>
<select id='selChannels' class='span3'>
<option value="facebook" <?php echo (($selected_channel == "facebook") ? "selected='selected'" : ""); ?>>facebook</option>
<option value="twitter" <?php echo (($selected_channel == "twitter") ? "selected='selected'" : ""); ?>>twitter</option>
</select>
<input class='btn btn-primary' type='submit' id='divSelectChannel_btnSubmit' value='Submit' />
<input class='btn' type='button' id='divSelectChannel_btnBack' value='Back' />
</div>
</form>
You need to retrieve the values of your url using the
$_GETglobal variable; an example of how to do this:If I misunderstood what you want, please let me know so I can modify this answer.