Forum Moderators: coopster
When the form is submitted to the processing page, how can we know what items had been submitted so that we can process and insert them in a database and so on?I thought of creating a loop and counter, but this will limit the dynamic form not making it fully dynamic in the actual sense that we want.
foreach ($_POST as $key => $value) {
if (preg_match('/^textbox\_\d+$/',$key) and ! empty($value)) {
// we found one of the dynamic fields, do whatever here
}
}
<?php
$submitted = array_keys($_POST,"marker");
$counter = array();
foreach($submitted as $value){
$value1 = substr($value,7);
if(!isset($counter[$value1])){
$counter[]= $value1;
}
}
foreach($counter as $counter2){
$numbername = 'value' . $counter2;
echo $numbername . "<br />";
echo $counter2 . " = " . $_POST[$numbername] . ", <br /><br />";
}
echo "<br />" . count($counter);
?>