php - Get Variable from Load Page -


i'm trying variable load page using jquery , php. let if have 2 pages. no-1.php page form display , have <select> list user have choose states , when user click, loads new <select> list page no-2.php inside <div>. user have select staff name based on state user choose earlier on page-1.php`.

here codes made

no-1.php (jquery call function user make selection on state)

$(document).ready(function() {     var p_id = $("#p_id").val(); //value form on page no-1.php     var pid = $("#pid").val(); //value form on page no-1.php      $('#list').load('no-2.php', {         "pid": pid,         "p_id": p_id     });     $('#lokasi').change(function() { //#lokasi state user choose         $.ajax({             type: "get",             url: "no-2.php",             data: {                 mlk: $(this).val() //value of state             }         }).done(function(data) {             $('#list').html(data)         });     }); }); 

no-2.php (<select> list user choose staff name base on state)

<select name="staff" id="staff">     //php select data db     <option value="<?php echo $row_mlk['staff_id']; ?>" <?php if($row_mlk[ 'staff_id']==$ p_id){ echo "selected"; } ?> >         <?php echo $row_mlk[ 'name']; ?>     </option> </select> 

the update process on page no-1.php. other data can update staff page no-2.php not updated. can show me right way of doing it.

issue solved

i able it! if need answer or guide, url refer to. hope helps,

https://css-tricks.com/dynamic-dropdowns/

thanks helped , time.

if($row_mlk[ 'staff_id']==$ p_id) {    echo 'selected="selected"'; } 

Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -