duanhuan5409 2014-04-12 11:37
浏览 32
已采纳

如何设置超链接?

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.

  • 写回答

2条回答 默认 最新

  • douchi0028 2014-04-12 11:45
    关注

    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>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器