I am trying to look through some input fields in a form and add them to a database. The user sets the number of fields, so I can't do something like the code below because there is no specific number of fields.
for($i=0; $i<(number-of-fields); $i++)
{
$_REQUEST['Question+$i']
}
I have tried this as well:
<?php
$con=mysqli_connect("","test","test","Flashcards");
foreach($_REQUEST['Question[]'] as $value)
{
$newcards="INSERT INTO Cards(Questions)
VALUES($value)";
mysqli_query($con,$newcards);
}
mysqli_close($con);
?>
It just doesn't add anything to my database. How should I go about doing this? I am new to PHP and SQL and can't seem to figure this out.
See Question&Answers more detail:os