Hello.
I have a query and it kinda works.
The last line gets inserted only.
Can someone see if they can figure out why it is not working.
It does not return any php errors. The only problem is Row 3 is the only data that makes it to the database. I would like Row 1, Row2 and Row3 to make it.
Thank you! I have abbreviated the code to just the goof.
<?php
if ($submit):
for ($y=0; $y<count($REQUEST['cid']); $y++)
{
$sql = "INSERT INTO tblData (EID, CID, SID, Date, Time, Description)
VALUES ('$id', '".$REQUEST['cid'][$y]."','".$REQUEST['sid'][$y]."','".$REQUEST['date'][$y]."','".$REQUEST['time'][$y]."','".$REQUEST['desc'][$y]."')";
}
if (@($sql)) {
echo("<p>New Batch Added</p>");
} else {
echo("<p>Error adding new Issue: " .
mysql_error() . "</p>");
}
?>
<?php
else:
?>
<form action="<?=$PHP_SELF?>" method="post" class="infogrid">
<CENTER>
<TABLE WIDTH="600" CELLSPACING=0 CELLPADING=0 BORDER=1>
<!-- Table Headings -->
<TR>
<TD>Employee (Auto Insert)</TD>
<TD>Client</TD>
<TD>Service</TD>
<TD>Date</TD>
<TD>Time</TD>
<TD>Description</TD>
</TR>
<!-- ROW #1 -->
<TR>
<TD width= 10></TD>
<TD><input type="text" name="cid[]" ...</TD>
<TD><input type="text" name="sid[]" ...</TD>
<TD><input type="text" name="date[]" ...</TD>
<TD><input type="text" name="time[]" ...</TD>
<TD><input type="text" name="desc[]" ...</TD>
</TR>
<!-- ROW #2 -->
<TR>
<TD width= 10></TD>
<TD><input type="text" name="cid[]" ...</TD>
<TD><input type="text" name="sid[]" ...</TD>
<TD><input type="text" name="date[]" ...</TD>
<TD><input type="text" name="time[]" ...</TD>
<TD><input type="text" name="desc[]" ...</TD>
</TR>
<!-- ROW #3 -->
<TR>
<TD width= 10></TD>
<TD><input type="text" name="cid[]" ...</TD>
<TD><input type="text" name="sid[]" ...</TD>
<TD><input type="text" name="date[]" ...</TD>
<TD><input type="text" name="time[]" ...</TD>
<TD><input type="text" name="desc[]" ...</TD>
</TR>
</TABLE>
<br>
<input type="submit" name="submit" value="SUBMIT" />
</form>
<?php endif; ?>