Issues with isset

ساخت وبلاگ
Code:

<?php

if(isset($_POST['submit']))
{
$n=$_POST['t'];
print "<form method=POST action=''>";
for($i=0;$i<$n;$i++)
{
print "<input type=text name=t$i>";
}
print "<input type=submit name=display value=Display>";
print "</form>";
}

$arr=array();

if(isset($_POST['display']))
{
//$n=$_POST['t'];
for($i=0;$i<$n;$i++)
{
$arr[$i]=$_POST['t'.$i];
}
print_r($arr);
}

?>

<form method=POST action=''>
<label>Enter the range:</label>
<input type=text name='t'>
<input type=submit name=submit value=Submit>
</form>

--------------------------------------------------------------------------------------
The purpose of this code is to input a range value in a textbox. According to that text boxes will be generated by the PHP code dynamically. The values entered in the text box is stored in an array and the values in the array should be finally printed. The problem in this code is, the range value entered in the text box is not available in the display isset so that array variable is not able to accept the values entered in the text box. For the first isset called submit, the $n variable is supplying the range value but for the second isset display, the $n variable value is not available. Help....
CodingForums...
ما را در سایت CodingForums دنبال می کنید

برچسب : نویسنده : codingforums بازدید : 149 تاريخ : سه شنبه 20 تير 1396 ساعت: 4:56