I have a little problem here with PHP and MySQL (hope this is the right section).
The problem is I have this really big form (almost 200 text fields) so, to make things easier and faster and I want to make a loop, to add a variable to mysql. This is what i made, but it's not working for some reason. Hope you can help me.
<?php
error_reporting(E_ALL);
echo "Processing"...
mysql_connect("localhost","username","password") or die(mysql_error());
mysql_select_db("chismografo") or die(mysql_error());
$q = array(5);
for ($cpost=1; $cpost < 6; $cpost++)
{
$q[$cpost]=_POST["T".$cpost];
}
MYSQL_QUERY("INSERT INTO datos (id,q1) VALUES ('NULL', '$q[1]')");
$scriteria=(MYSQL_QUERY("SELECT id FROM `chismografo`.`datos` WHERE q1='$q[1]'"));
for ($postn=2; $postn < 6; $postn++)
{
MYSQL_QUERY("INSERT INTO datos (id,q[$postn]) VALUES ('$scriteria', '$q[$postn]')");
}
echo "Query Finished";
?>