And the annoyances continue...
Why can't programming languages just do as I want them to?!
I wanted to INSERT the email address into the 'email' field of 3 tables.
Then inside the loop you generously coded for me, I wanted to UPDATE the db table it associates with with the value. It would do this over n over. Updating each component one after the other in a loop. The code is below. The only part that work is if I typed in an integer into the form.
PHP Code:
<?php
if(is_array($_POST['c']))
{
foreach($_POST['c'] as $key => $value)
{
$query2="
UPDATE ratings
SET q$key = $value";
mysql_query($query2);
}
}
if(is_array($_POST['s']))
{
foreach($_POST['s'] as $key => $value)
{
$value = str_replace("\n","<br />",$value);
$query3="
UPDATE service
SET s$key = $value";
mysql_query($query3);
}
}
if(is_array($_POST['msg']))
{
foreach($_POST['msg'] as $key => $value)
{
$value = str_replace("\n","<br />",$value);
if ($value == 0)
{
$value == "-";
}
$query3="
UPDATE comments
SET msg$key = $value";
mysql_query($query3);
}
}
?>
What's happening is the email address is being saved using previous SQL statements but when it comes to the 'meat', it doesn't save anything. No errors show on the thankyou.php page that do this code.
The table fields are set to 'TEXT' so that isn't the problem.
I don't know why it won't work but as soon as I get this job done I swear on my broken CD collection that I'll go find a girlfriend and leave PHP alone to the pros...