I have this Array
array
0 =>
array
'id' => 1
'name' => Peter
'desc'
'date'
1 =>
array
'id'
'name'
'desc'
'date'
And I want to echo for example Array[0]['name'] inside my input type text. This is my code up to now.
<select id="SelID">
<?php
foreach ($Array as $SubArray) {
echo '<option value ="'.$SubArray["id"].'">'.$SubArray["name"].'</option>';
}
?>
</select>
<input type="text" id="name" name="name"/>
<script type="text/javascript">
$('#SelID').change(function(){
$('#name').val(this.value);
});
This way, I'm changing my input's value to the index of the Select. What I need, is to replace it with
$Array[Index(this.value I tried)]['name']
and get "Peter"
inside my input.
Thanks!