So, I have a problem with getting data from forms and using it in my codes. this is choose options page:
        <form action="options.php" method="post"> 
        <label>Select number of options:</label>
        <select name="options">
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
        </select><br><br>
        <input type="submit" name="next" value="Next"><br><br>
    </form> 
and this is options.php page
<?php
    // put your code here
    $options = $_POST['options'];
    if (isset($_POST['submit'])) {
        echo $options;
    }
    ?>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
        Fill in the following fields:<br><br>
        <?php
        //loop to prompt the user to enter options' details
        for ($i = 1; $i <= $options; $i++) {
            $optionName = "option$i";
            ?>
            <?php echo 'Option ' . $i; ?><input type="text" name="<?php echo $optionName; ?>"/><br><br>
            <?php
        }
        ?>
        <input type="submit" name="submit" value="Next"/>
    </form>
Somehow I can't get it working. It keeps giving me an error which is "undefined index". I tried to fix it with isset(). I keep doing something wrong here but I don't know what is it. Will someone please help me or suggest some solutions and ways to get it working. I am new at this and started learning last week.
 
     
     
     
    