Users of my website can generate a custom form. All the fields are saved in a database with a unique ID. When someone visits the form, the fields 'name' attribute is field*ID*, for example
<p>Your favorite band? <input type="text" name="field28"></p>
<p>Your Favorite color? <input type="text" name="field30"></p>
After submitting the form, I use php to validate the form, but I don't know retrieve the value of $_POST[field28] (or whatever number the field has).
<?
while($field = $query_formfields->fetch(PDO::FETCH_ASSOC))
{
$id = $field[id];
//this doesn't work!!
$user_input = $_POST[field$id];
//validation comes here
}
?>
If anybody can help me out, it's really appreciated!
Add some quotes:
$user_input = $_POST["field$id"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With