PHP/Javascript: Same input “id” in while

Hoibiabah4

New Member
In my friends page, when you accept a user, it sends a ajax call:\[code\]function MeYouFriendNB(confirm){ var c = confirm ? 'confirm' : 'ignore';var fID = $('.fID').val(); $.ajax({ type: "POST", url: "misc/AddFriend.php", data: { mode: 'ajax', friend: c, uID : $('#uID'+fID).val(), fID : $('#fID'+fID).val(), bID : $('#bID'+fID).val() }, success: function(msg){$('#friend'+fID).slideUp('slow');$('#Friendlist').prepend(msg); $('#theNewFriend').slideDown('slow'); } });}\[/code\]On each friend request, there's a link to the function:\[code\]<?phpwhile($showW = mysql_fetch_array($friendsWaiting)){echo "<div id='friend".$showW['id']."' style='position: relative; background: #3a5f6e;'>";?> <input type="hidden" name="fID" class="fID" value="http://stackoverflow.com/questions/3590994/<? echo $sInfo["id"]; ?>"> <input type="hidden" name="uID" id="uID<? echo $showW["id"]; ?>" value="http://stackoverflow.com/questions/3590994/<? echo $sid; ?>"><input type="hidden" name="fID" id="fID<? echo $showW["id"]; ?>" value="http://stackoverflow.com/questions/3590994/<? echo $showW["id"]; ?>"><input type="hidden" name="bID" id="bID<? echo $showW["id"]; ?>" value="http://stackoverflow.com/questions/3590994/<? echo $showW["bID"]; ?>"> <?phpecho "<div style='position: absolute; top: 15px; right: 105px;'><a href='javascript:void(0);' onclick='MeYouFriendNB(true);' style=' margin-right: 45px; color: #FFF;'>Bekr?fta</a> <a href='javascript:void(0);' onclick='MeYouFriendNB(false);' style='color: #ccc;'>Ignorera</a></div>";}?>\[/code\]But everytime it sends the ajax call, it gives same fID, bID and uID, to every friendrequest. So e.g if i have 5 friend request, them all have same fID, uID and bID.As you can see i tried to make the bID and uID and fID
 
Back
Top