Hi,
My problem is possibly easy to fix, I just can't see what's wrong.

The following code outputs rows with product images, description AND a textarea to write some comments to each of the rows.

$output[] = '<td align="center" width="100"><textarea name="comments" cols="35" rows="5">'.$_SESSION['comments'].'</textarea></td>';

And this is wrapped in a form to submit the textarea changes calling an action "update".

The update function takes the post and puts it in a session.

case 'update':
	  $_SESSION = $_POST;
	  foreach($_POST as $key=>$value){
		  $_SESSION[$key]=$value;
	  }

My problem is, if I put some text in, it will update all textareas. How do I get the textareas to update only the row where changes have been made.

Thanks for any advice.

I have added $id to textarea name to get unique names. Is this the way I should go?

$output[] = '<td align="center" width="100"><textarea name="comments[]'.$id.'" cols="35" rows="5">'.$_SESSION['comments'].'</textarea></td>';
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.