Jump to content

issues getting all values from $_POST


whoisvince

Recommended Posts

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!  :confused:  :'(

 

[attachment deleted by admin]

Link to comment
Share on other sites

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  :D

 

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.