Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 你能要两个吗;"死亡";同时工作?_Php - Fatal编程技术网

Php 你能要两个吗;"死亡";同时工作?

Php 你能要两个吗;"死亡";同时工作?,php,Php,我正在创建一个网站,人们可以在这里评论他们与之打过交道的公司。当web用户输入评论并提交时,这些评论将存储在数据库中。然后他会被问到两个问题中的一个:他是想对另一家公司发表评论,还是想注销。您将在下面的“die”函数旁边看到,用户可以选择发表另一条评论。但我的问题是,我怎么才能做出另一个让他退出的“死亡”声明呢?注销页面称为“logout.php”。将他注销的“死亡”声明如下: die(“我想现在注销” “a href='logout.php”→ 请让我注销!/a“ (我将忽略HTML标记。)

我正在创建一个网站,人们可以在这里评论他们与之打过交道的公司。当web用户输入评论并提交时,这些评论将存储在数据库中。然后他会被问到两个问题中的一个:他是想对另一家公司发表评论,还是想注销。您将在下面的“die”函数旁边看到,用户可以选择发表另一条评论。但我的问题是,我怎么才能做出另一个让他退出的“死亡”声明呢?注销页面称为“logout.php”。将他注销的“死亡”声明如下:

die(“我想现在注销” “a href='logout.php”→ 请让我注销!/a“

(我将忽略HTML标记。)

我的问题是,当我将“die”函数放在第一个“die”函数的正下方时(这样用户就可以看到两个超链接,一个是他想发表另一条评论,另一个是他只想注销),我只能看到第一个超链接:-->发表另一条评论。我没有看到允许用户注销的超链接。我不明白。有人能帮忙吗

<!DOCTYPE html>

<html>
<head>
<style>
body {background-color:green}
h1 {color:blue}
/* Plenty of CSS goes in here */
</style>
</head>
<body>

    <?php
   require_once 'connect.php';

   include "display.php";

 // plenty of isset functions go in here

   else if(isset($_POST['company']))
   {
         $company = $_POST['company'];
         $username = $username;
         $commentary = $_POST['commentary'];

         // write comment to data base
        mysqli_query($dbcon,"INSERT INTO `mycomments`  (`username`, 
     `company`, `commentary`) VALUES ('$username',
     '$company', '$commentary')");

        mysqli_close($dbcon);

         die("Your comments will be seen by: $company </br>"
             . "<a href = 'recordedcomments.php'> &rarr; Make another       
      comment!</a>");

   }

 else {


    ?>


<h1>Which other company do you want to make a comment about?</h1>
<div id="form">
            <form method="post" action="somefilename.php">
   <!--Plenty of HTML goes in here-->
            </form>
        </div>

<script type='text/javascript'....></script>

 </body>
 </html>

正文{背景色:绿色}
h1{颜色:蓝色}
/*这里有很多CSS*/

这确实不是您应该如何使用
die
。它的全部意义在于它停止了脚本的进一步执行

考虑改用
echo

您意识到使用die()将终止脚本执行,因此不会呈现以下标记的其余部分,包括结束正文和html标记