Why can I not call my PHP script from HTML button? -
i using button html script unset cookies, cannot make call php script through button click.
html script
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>wcsst 2</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <style type='text/css'> </style> </head> <body> <button style="color: black" <?php if(isset($_cookie["name"])) { ?> disabled <?php } ?> value='set cookie'><b>unset cookie</b></button> <!-- end page source --> </body> </html>
php script
<?php unset($_cookie['name']); unset($_cookie['age']); header("location: cm.php"); exit(0); } ?>
how can make call php script through button click?
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>wcsst 2</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <style type='text/css'> </style> </head> <body> <?php if(isset($_cookie["name"])) { ?> <button style="color: black" onclick="window.location.href='unset.php'"><b>unset cookie</b></button> <?php }else{ ?> <button style="color: black" onclick="window.location.href='set.php'"><b>set cookie</b></button> <?php } ?> </body> </html>
unset.php script
<?php unset($_cookie['name']); unset($_cookie['age']); header("location: cm.php"); exit(0); } ?>
set.php script
<?php // set cookie ?>
Comments
Post a Comment