php - form submit inside navigation menu -
what need this
my php code is:
class logout{ public function __construct(){ session_unset(); session_destroy(); session_write_close(); setcookie(session_name(),'',0,'/'); session_regenerate_id(true); } } if(!empty($_post['logout'])){ $object=new logout(); }
for i'm using html code:
<ul id="navlist"> <li><a href="index.php">home</a></li> <li><a href="dates.php">dates</a></li> <li><a href="candidate.php">candidates</a></li> <li><a href="database.php">database</a></li> <li><a href="password.php">change password</a></li> <li><a href='logout.php'>log out</a></li> </ul>
for logout need javascript form submit anchor i've read not secure.
if this:
<li><a href=''><form method="post"><input type='submit' value='log out' name='logout' style="border:0px;" /></form></a></li>
i'm getting this:
how solve problem (do i've use javascript how submit form?)
you can via ajax if have jquery loaded. way can keep nav styling well.
<li><a href="#" class="log-out">log out</a></li> $('.log-out').click(function() { $.post('logout.php'); });
Comments
Post a Comment