whoisvince Posted March 16, 2010 Share Posted March 16, 2010 I've been trying to access the id's of the rows that are within a loop... however i have not the slightest idea how.. I'm trying to edit multiple input fields & need both the matching row id & the value to make the mysql update, but right now im only getting the value. if ($result3) { $num_results = $result3->num_rows; for ($i=0; $i <$num_results; $i++) { $row = $result3->fetch_assoc(); echo "<li id=\"menu_".$row['todoid']."\"><input type=\"text\" "; echo "name=\"taskinfo[$i]\" "; echo "value=\"".stripslashes($row['task'])."\">"; echo "</li> \n"; } } i've tried everything that i know of to get the "$row['todoid']" .... i have the "$row['task']" value from the 'taskinfo' array via foreach($_POST['taskinfo'] AS $key => $value) { echo $key; echo "<br />"; echo $value; echo "<br />"; } but not sure what to do next... any help is very much appreciated! :'( [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/195407-issues-getting-all-values-from-_post/ Share on other sites More sharing options...
Wolphie Posted March 16, 2010 Share Posted March 16, 2010 You can't get the row ID using PHP unless it's in the URL. You'd have to use JavaScript to get the row ID and then process it using AJAX. Link to comment https://forums.phpfreaks.com/topic/195407-issues-getting-all-values-from-_post/#findComment-1026862 Share on other sites More sharing options...
whoisvince Posted March 16, 2010 Author Share Posted March 16, 2010 You can't get the row ID using PHP unless it's in the URL. You'd have to use JavaScript to get the row ID and then process it using AJAX. Hey Wolphie, thanks for the heads up... that was one of my thoughts, but i just figured there was something i just didn't know about... i know this isn't a javascript forum, or more specifically jquery forum either... but if you could lend a hand on how i would get that working that would be great i'm trying this below (& a plethora of other versions of this) & im not getting anything out when i try & echo out the 'editid'... $el = $('#edit form'); var editid = $('#menu', $el).val(); $.ajax({ type: "POST", url: "edit-update.php", data: "&editid="+ editid, success: function(){ $('div.success').fadeIn().fadeOut(4000); } }); but when i call echo $_POST['editid']; it doesn't return anything.. Link to comment https://forums.phpfreaks.com/topic/195407-issues-getting-all-values-from-_post/#findComment-1027013 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.