PHP code is not recognizing HTML

Asked

Viewed 36 times

-1

I wrote an HTML code within a structure for, but is not identifying, follows the code:

<form method="get" action="_modelophp.php">
    <h1>tabuada</h1>
    <select name="num">
        <?php
            for{$inicio=1;$inicio<=10;$inicio++}{
                echo "<option>$inicio</option>";
            }
        ?>
    </select>
  • I do not know if it will solve but take it from the beginning of your . PHP <!DOCTYPE html>

  • What happens (define "is not identifying")? what error appears?

  • 2

    Your for has a mistake, it should be like this, for($inicio=1;$inicio<=10;$inicio++){

1 answer

1

Your for is poorly structured.

You are wearing braces { } inves de parentheses ( ).

for{$inicio=1;$inicio<=10;$inicio++}{
    echo "<option>$inicio</option>";
}

In other words, the code should be like this

for($inicio=1;$inicio<=10;$inicio++){
    echo "<option>$inicio</option>";
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.