How can I write the insert statement for the following type of scenario?
<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
<input type="text" name="tbxt[]" />
<input type="text" name="tbxt[]" />
<input type="text" name="tbxt[]" />
<input type="text" name="tbxt[]" />
<input type="text" name="tbxt[]" />
<input type="submit" name="dosubmit" value="Next" class="submitbtn" />
<form>
I tried like the below which didn't work for me
<?php
if (isset($_POST['dosubmit'])) {
foreach ($_POST['tbxt'] as $tbxt)
{
for ($i=0; $i<5; $i++)
{
$doquery = mysql_query("INSERT INTO mylist(`itemname`) VALUES('".$tbxt[$i]."')") or die(mysql_error());
}
}
}
?>
Also, how can I write the array count instead of $i<5