Is it possible to isset()
a hyperlink? I can't seems to make it work. I don't know what to do; I looked for many solutions, but they used $_GET
or $_REQUEST
. I don't want to use those. I want to make it work like a submit button I am new to PHP and here is what I have done:
<?php
session_start();
if (!isset($_SESSION['suser'])) {
header("location:register.php");
session_write_close();
exit;
}
error_reporting(E_ALL);
include 'conectthis.php';
$suser = $_SESSION['suser'];
mysql_select_db("$suser", $con);
if (isset($_POST['select'])) {
$result = "SHOW TABLES FROM $suser";
$show = mysql_query($result) or die(mysql_error());
if (!$show) {
echo "<script type='text/javascript'>alert('Create Master List First'); </script>";
exit;
}
}
?>
<body>
<hr />
<div align="center"><h1>Selection</h1></div>
<hr />
<form action="select.php" method="post">
<table width="50%" align="center">
<tr><td><a href="studrecord.php">Student Record </a></td><td><a name="select" href="fq1.php">First Period</a></td><td><a name="select2" href="fq2.php">Second Period</a></td><td><a name="select3" href="fq3.php">Third Period</a></td><td><a name="select4" href="fq4.php">Fourth Period</a></td><td><a name="summary" href="summary.php">Summary</a></td></tr></table>
</form></body>
I want a hyperlink to alert message something when the user have clicked a hyper link.
I hope you understand my English.
Thank you.
This is a shot in the dark, but is this what you want?
Show a message which is set through PHP.
<a href="#" onclick="return showMessage('<?php echo 'say hello'; ?>');">Click Me</a>
<script type="text/javascript">
function showMessage(message){
alert(message);
}
</script>
Show a message using just JavaScript.
<a href="#" onclick="return showMessage();">Click Me</a>
<script type="text/javascript">
function showMessage(){
alert('hello);
}
</script>
This would be done with JavaScript via a click
event. PHP would have no part in it.