PHP changing form button to link with the method of the form being post -
print('<form method="post"><button title="logout" name="logout">logout</button></form>');
is there way can replace button text , still post me , log me out
update: ok guys want link instead of being button hyper link exact same action here more code see im working (there's more code im showing stuff)
if(isset($_get['login'])) { $user->signin(); } if (array_key_exists( 'logout', $_post )) { setcookie('steamid', '', -1, '/'); header('location: /'); } if(!$_cookie['steamid']) { print ('<form action="?login" method="post"> <a href="?login"> sign in through steam</a> </form>'); } else { print('<form method="post"><button title="logout" name="logout">logout</button></form>'); echo $user->getplayersummaries($_cookie['steamid'])->personaname; }
yes use instead
print('<a href="logout.php?logout">logout</a>');
and can change logout.php
use $_request work whether use post or get. add exit;
after header()
or script continue executing remains of script , dont want that.
if(isset($_get['login'])) { $user->signin(); } if (array_key_exists( 'logout', $_request )) { setcookie('steamid', '', -1, '/'); header('location: /'); exit; }
Comments
Post a Comment