I have this query (Javascript) function that it's changed an input value every time I change the select menu. I bring the value from a php variable. (See the example). For every option
in my select
I insert a value from 1 to n like this:
$i = 0;
foreach($videos as $val)
{
echo '<option value='.$i.'>'.$val->title.'</option>';
$i++;
}
So the idea am I bringing the option value with JQuery and I want to use in a PHP expression that I use in Javascript and I want to know how put the javascript variable in PHP expression in this case (See my example PHP echo $videos [ii] ->title;
Exactly this expression the ii it's a javascript variable and the rest is PHP)
$('select').change(function(){
var i = $( "#select option:selected" ).val();
var ii = parseInt(i,10);
$( "#titre" ).val("<?php echo $videos[ii]->title; ?>");
});
Thanks