0

This is my HTML form:

<div class="container">
            <div class="panel panel-default">
                <div class="panel heading">
                    <h1 style="text-align: center;">Choose your difficulty level </h1>
                </div>
                <div class="panel-body">
                    <div class="form-group">
                        <fieldset>
                            <form action="backup.php" method="POST">
                                <h4>What is your difficulty level?</h4>
                                <select name="startdiff" class="form-control">
                                    <option value="5">5</option>
                                    <option value="10">10</option>
                                    <option value="15">15</option>
                                </select>
                                <br />
                                <input type="button" name="subdiff" class="btn-primary btn-lg btn-success" value="Let's go!">
                            </form>
                        </fieldset>
                    </div>
                </div>
            </div>
        </div>

And this is what "backup.php" looks like:

<?php
include('connect.php');
include('my_class.php');

$admin = new User();

if (isset($_POST['subdiff']))
{

    $difficulty = $_POST['startdiff'];

    $admin->set_difficulty($difficulty);

    header('Location: getstarted.php');

}


?>

Note that I named it backup.php because my POST methods were all contained in one huge switch method but this specific form is the only one giving me problems, so please don't advise me on conventional naming methods.

What could be the problem?

7
  • 1
    What do you mean by not running? It's not setting the difficulty? Or redirecting? Or never gets to backup.php? Commented Jun 16, 2017 at 16:29
  • What's in the PHP error log? Commented Jun 16, 2017 at 16:30
  • 1
    Is the backup.php file in the same directory as the HTML? Commented Jun 16, 2017 at 16:32
  • 3
    Have you tried to change <input type="button"> to <input type="submit">? Commented Jun 16, 2017 at 16:33
  • @BenM It actually doesn't do anything at all when I click the <input> button, and it doesn't redirect to "getstarted.php" Commented Jun 16, 2017 at 16:34

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.