Jump to content

ronniepeter

New Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ronniepeter

  • Rank
    Newbie
  1. Thank you very much for the reply Mr. Guru. I will surely change the code according to your suggestion. But my problem is still persisting. The problem is, for the isset display, the $n variable that I used to accept the range value is not made available. If I substitute a value instead of the $n variable that I have used in the for loop of isset display, it works and the array prints the values. Is there any way to make the value of the $n variable available in isset display. Thank you.
  2. <?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....
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.