简体   繁体   English

如何设置超链接?

[英]How to Isset a hyper link?

Is it possible to isset() a hyperlink?是否可以isset()一个超链接? 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 .我寻找了很多解决方案,但他们使用了$_GET$_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 新手,这是我所做的:

<?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.显示通过 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.仅使用 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.这将通过click事件使用 JavaScript 完成。 PHP would have no part in it. PHP 不会参与其中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM