note 87337 deleted from language.variables.variable by cmb

From: Date: Sun, 12 Jan 2020 08:31:45 +0000
Subject: note 87337 deleted from language.variables.variable by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213862@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- I have a HTML form that has a dynamic number of fields (for entry of collected data it adds a new field each time) and would like to use the variable variable on _POST. This way, I could increment the field name value with a loop limit when say 100 fields are reached (the max for the form.) Below is the solution I came up with to work around it: <?php $MaxRows=100; $NumbersOfTime=0; extract ($_POST,EXTR_PREFIX_ALL,'pos'); for ($i = 1; $i <= $MaxRows; $i = $i + 1) { $tmp = "pos_TimeRecorded{$i}"; if (isset($$tmp)) { $TimeRecorded[$i]=$$tmp; } else { $NumbersOfTime=$i-1; break; } } ?>

« previous php.notes (#213862) next »