Page Preview Error with PHP Code

Asked

Viewed 68 times

0

inserir a descrição da imagem aqui

Can anyone help me understand why the code below is wrong? Some parameterization is missing so that it does not appear on the main page?

                <?php } if (isset($_POST['submitBtn'])){
            ?>
            <div class="caption">Resultado do Login:</div>
            <div id="icon2">&nbsp;</div>
            <div id="result">
            <table width="100%">
              <tbody>
                <tr>
                  <td><br />
                  <br />
            if ($error == "") {
            echo "Benvindo";
            echo "<a href="index.php">Click aqui para entrar.</a>";
            }
            else echo $error;
            ?&gt;
                  <br />
                  <br />
                  <br />
                  </td>
                </tr>
              </tbody>
            </table>
            </div>
            <?php }
            ?> </div>
            </div>
  • Can you explain the problem better? What would be "this does not appear on the main page"? Is the PHP code itself being displayed? If yes, you are running the file on a PHP-supported server?

  • I added a photo op, which demonstrates what appears on the page. Supposedly this field should be hidden, so when we do a wrong login it goes back to the home page.

  • Provide more details about the problem, so it’s hard to help. Ask a larger part of the code.

  • It is already possible to help in this way?

  • Impossible to say for sure. Still the question makes no sense. But I’ve noticed that you’re using double quotes inside the string in PHP; this breaks the string and generates the unexpected result. Try changing to simple quotes: echo "<a href='...'>...</a>" (note the simple quotes in href of the link).

  • Try this: if ($error == "") { echo "Benvindo <br/> <a href='index.php'>Click aqui para entrar.</a>";&#xA; }

  • It’s not working yet.. I’ll put a sharper image, it might help.. the code is too long to put it here

  • The problem that arises next is that after logging in, the page does not go to the intended one, but if you click where it says "Click here to log in.! that’s where it comes in..

  • what a start this is <?php }

Show 4 more comments

2 answers

0

Code structure is with a small error, the correct serious:

<?php } if (isset($_POST['submitBtn'])){ ?>
        <div class="caption">Resultado do Login:</div>
        <div id="icon2">&nbsp;</div>
        <div id="result">
        <table width="100%">
          <tbody>
            <tr>
              <td><br />
              <br />
       <?php
          if ($error == ""){
            echo "Benvindo";
            echo "<a href="index.php">Click aqui para entrar.</a>";
          }else
            echo $error;
        ?>
              <br />
              <br />
              <br />
              </td>
            </tr>
          </tbody>
        </table>
        </div>
        <?php } ?>
        </div>
        </div>

0

Add the php tags, <?php and ?> for this part of the code:

if ($error == "") {
 echo "Benvindo";
 echo "<a href="index.php">Click aqui para entrar.</a>";
}
 else echo $error;
  • The problem that arises next is that after logging in, the page does not go to the intended one, but if you click where it says "Click here to log in.! that’s where it comes in..

Browser other questions tagged

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