i have this code. the looping code. but i dont know how to pass the value to the next page. help me please! :P


$req = $_POST['req'];

echo "<form>";

echo "</form>";

while($i <= $req) {
    echo "<label>Requirement " . $i . " :</label><br/";
    echo "<input name=\"req".$i."\" type=\"text\" /> <br />";

echo "<br />";
echo "<input name=\"submit\" type=\"submit\" />";


Welcome to daniweb. I would suggest placing the value in a hidden field where when the next field is submitted it will then again be added to the $_POST array. So the following is an example:

$req = $_POST['req'];

echo '<form>';
for ($i=1; $i <= $req; $i++) {
echo '<label>Requirement ' . $i . ' :</label><br/>';
echo '<input name="req'.$i.'" type="text" /> <br />';
echo '<br /><input name="submit" type="submit" />';
echo '<input type="hidden" name="req" value="'.$_POST['req'].'"></form>';

Second page


I also fixed a html bug in your code and changed the loop to make it run faster. And please use code tags.