0

I tried many times to make this work, and I can't... I am a PHP beginner and I'd like to know how to do that. I know there is a way of using buttons but I need to use the "a" command for my website design...

this is my code:

<form method="post">
        <li class="nav-item">
      <a name="logout_button" value="logout_button" class="nav-link navbar_loginout" type="submit">Logout</a>
    </li> 
    </form>
<?php
if (isset($_POST["logout_button"])) {
  echo "hi";
  $_SESSION["allowed"] = 0;
}


?>
Tomergngn
  • 64
  • 9
  • 2
    Why do you need to use an anchor tag? A submit button is exactly the semantic structure for something you'd click to submit a form. You can *style* that button to look like whatever you want. – David Apr 30 '20 at 18:41
  • 1
    Use a button instead, but you can add `text-decoration: underline;`, `background-color: transparent;`, `border: none;`, `color: blue;` and `cursor: pointer;` to make it look like the `` tag. – MARSHMALLOW Apr 30 '20 at 18:44
  • Thanks so much!!! You really made my day – Tomergngn May 03 '20 at 18:22

0 Answers0