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