Multiple inserts from form with 2 variables?

I’m trying to figure this out. I want to insert multiple rows from a single form into mysql but I want to be able to insert 2 variables.

Here is what I got:

echo '<form method="post" action="updatelang.php">';
$sql = mysql_query("SELECT * FROM language WHERE lang = 'en' ORDER BY id");
while($row = mysql_fetch_assoc($sql)){
	
	$snippetid = $row['id'];
	
	echo 'Original Text: '.$row['text'].'<br>';
	echo 'New Text: <textarea name="thistext[]"></textarea>';
	
}
echo '</form>';

And here is my updatelang.php:¨

foreach($_POST['thistext'] as $row){
	if(!empty($row)){
		mysql_query("INSERT INTO language (fk_id,text) VALUES (???,'$row')");
	}
}

Now what I want is to get the “$snippetid” with me into the foreach and into my INSERT but downt know how?

Please help and Thanks in advance :wink:

You can either put the $snippetid in thistext[$snippetid] or pass it in a hidden input

So if I do this: thistext[‘.$snippetid.’] how should I get the foreach($_POST[‘thistext’] as $row) out with the pair… ThisText and snippetid?

$_POST[‘thistext’] is the array, and $snippetid is the key, so it would be:

foreach( $_POST[‘thistext’] as $k => $v )

$k is the snippetid and $v is the text