0

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.

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by pixeldiver
0

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>';
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.