javascript - ALWAYS Getting the same ID from the different dropped images -


i have 7 different divs (from #rang1 #rang7) , can drop images on them.
images class .draggeditem come database , of them
have different id's. display these images normal fetch_assoc. if it's necessary
see code of doing please tell me can post it. it's regular
fetch_assoc method.
no further talking let's jump code

the js:

<script type="text/javascript"> $(function(){     $(".draggeditem").draggable({             helper:'clone',              cursor:'move',             revert: true     });      $('#rang1').droppable({       drop: function( event, ui ) {         //$('#rang1input').val($(ui.draggable).attr('id'));         var elemid = ui.draggable[0].id;         $("#rang1input").val(elemid);         var imgsrc = ui.helper[0].src;         var $img = $('<img></img>');         $img.width(90);         $img.height(90);         $img.attr('src', imgsrc);          $('#rang1').append($img);       }     });      $('#rang2').droppable({       drop: function( event, ui ) {         //$('#rang2input').val($(ui.draggable).attr('id'));         var elemid = ui.draggable[0].id;         $("#rang2input").val(elemid);         var imgsrc = ui.helper[0].src;         var $img = $('<img></img>');         $img.width(90);         $img.height(90);         $img.attr('src', imgsrc);          $('#rang2').append($img);       }     });      $('#rang3').droppable({       drop: function( event, ui ) {         //$('#rang3input').val($(ui.draggable).attr('id'));         var elemid = ui.draggable[0].id;         $("#rang3input").val(elemid);         var imgsrc = ui.helper[0].src;         var $img = $('<img></img>');         $img.width(90);         $img.height(90);         $img.attr('src', imgsrc);          $('#rang3').append($img);       }     });      $('#rang4').droppable({       drop: function( event, ui ) {         //$('#rang4input').val($(ui.draggable).attr('id'));         var elemid = ui.draggable[0].id;         $("#rang4input").val(elemid);         var imgsrc = ui.helper[0].src;         var $img = $('<img></img>');         $img.width(90);         $img.height(90);         $img.attr('src', imgsrc);          $('#rang4').append($img);       }     });      $('#rang5').droppable({       drop: function( event, ui ) {         //$('#rang5input').val($(ui.draggable).attr('id'));         var elemid = ui.draggable[0].id;         $("#rang5input").val(elemid);         var imgsrc = ui.helper[0].src;         var $img = $('<img></img>');         $img.width(90);         $img.height(90);         $img.attr('src', imgsrc);          $('#rang5').append($img);       }     });      $('#rang6').droppable({       drop: function( event, ui ) {         //$('#rang6input').val($(ui.draggable).attr('id'));         var elemid = ui.draggable[0].id;         $("#rang6input").val(elemid);         var imgsrc = ui.helper[0].src;         var $img = $('<img></img>');         $img.width(90);         $img.height(90);         $img.attr('src', imgsrc);          $('#rang6').append($img);       }     });      $('#rang7').droppable({       drop: function( event, ui ) {         //$('#rang7input').val($(ui.draggable).attr('id'));         var elemid = ui.draggable[0].id;         $("#rang7input").val(elemid);         var imgsrc = ui.helper[0].src;         var $img = $('<img></img>');         $img.width(90);         $img.height(90);         $img.attr('src', imgsrc);          $('#rang7').append($img);       }     }); }); </script> 

the html:

<form action="<?php echo $_server["php_self"] ?>" method="post"> <input type="hidden" value="<?php echo $row["idbewoner"] ?>" name="bewoner"> <td>      <div id="rang1"></div>      <input type="hidden" value="" id="rang1input" name="rang1value"> </td> <td>      <div id="rang2"></div>      <input type="hidden" value="" id="rang2input" name="rang2value"> </td> <td>      <div id="rang3"></div>      <input type="hidden" value="" id="rang3input" name="rang3value"> </td> <td>      <div id="rang4"></div>      <input type="hidden" value="" id="rang4input" name="rang4value"> </td> <td>      <div id="rang5"></div>     <input type="hidden" value="" id="rang5input" name="rang5value"> </td> <td>      <div id="rang6"></div>      <input type="hidden" value="" id="rang6input" name="rang6value"> </td> <td>      <div id="rang7"></div>      <input type="hidden" value="" id="rang7input" name="rang7value"> </td> <input type="submit" value="save"> </form> 

the php code:

<?php   if($_server["request_method"] == "post") {     $rang1 = $_post["rang1value"];     $rang2 = $_post["rang1value"];     $rang3 = $_post["rang1value"];     $rang4 = $_post["rang1value"];     $rang5 = $_post["rang1value"];     $rang6 = $_post["rang1value"];     $rang7 = $_post["rang1value"];     $bewonerid = $_post["bewoner"];      echo "<script>alert($rang1)</script>";     echo "<script>alert($rang2)</script>";     echo "<script>alert($rang3)</script>";     echo "<script>alert($rang4)</script>";     echo "<script>alert($rang5)</script>";     echo "<script>alert($rang6)</script>";     echo "<script>alert($rang7)</script>";     } ?> 

the problem i'm getting same id when submit form.
think it's wrong script not php code. tried
id of dropped images in different ways. have different images
with different id's i'm getting same id on , on again.

i think looking same post value, try this:

$rang1 = $_post["rang1value"]; $rang2 = $_post["rang2value"]; $rang3 = $_post["rang3value"]; $rang4 = $_post["rang4value"]; $rang5 = $_post["rang5value"]; $rang6 = $_post["rang6value"]; $rang7 = $_post["rang7value"]; 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -