Search code examples
phpmysqlcodeignitercodeigniter-3

Pass multiple variables to PHP file


Hi i am currently having trouble to figure out how can i pass a second variable via url to a php file.

Bellow is the code

function getmodel()
{
    var mod = [];
    jQuery('.cells:checked').each(function()
    {
        mod.push($(this).val());   
     });
    model=mod.toString();
    var date = document.getElementById("date").value; // this is the variable that i would like to pass next to the model
    urlt='<?php echo base_url();?>excel/export.php?models='+model;
    window.location.replace(urlt);
}

So i have managed to pass the model, but i would like to add the date variable to. The date is defined by the user.

Any ideas or guidance what i should look into,

Thanks in advance.


Solution

  • try this

    urlt='<?php echo base_url();?>excel/export.php?models='+model+'&yourdate='+data;
    

    Please have a look at this answer.

    yourdate is 2nd variable name that will pass now