首页 > 解决方案 > 尝试在自定义论坛上发布新主题时出现空白页面

问题描述

我是新来的...

我试图自己解决这个问题,但由于我对 PHP 太陌生,所以我做不到。你看,在我负责创建的论坛上工作时,我几乎完成了它,但是当我测试“创建主题”功能时,它并没有让我回到主题子类别(新主题出现的地方) . 相反,它保持锁定在白色屏幕上。

可能发生了什么?顺便说一下,这是代码:

<?php
include ('layout_manager.php');
include ('content_function.php');
?>
<html>
<head><title>Inki's PHP Forum Tutorial</title></head>
<link href="/forum-tutorial/styles/main.css" type="text/css" 
rel="stylesheet" />
<body>
<div class="pane">
<div class="header"><h1><a href="/forum-tutorial">PHP and MySQL Forum 
Tutorial</a></h1></div>
<div class="loginpane">
<?php
session_start();
if (isset($_SESSION['username'])) {
logout();
} else {
if (isset($_GET['status'])) {
if ($_GET['status'] == 'reg-success') {
echo "<h1 style='color: green;'>new user registered successfully!</h1>";
} else if ($_GET['status'] == 'login-fail') {
echo "<h1 style='color: red;'>invalid username and/or password!</h1>";
}
}
loginform();
}
?>
</div>
<div class="forumdesc">
<p>Welcome to the world's coolest forum made with PHP and MySQL... for noobs 
just like you!</p>
</div>
<div class="content">
<?php
if (isset($_SESSION['username'])) {
echo "<form action='/forum-tutorial/addnewtopic.php? 
cid=".$_GET['cid']."&scid=".$_GET['scid']."'
method='POST'>
<p>Title: </p>
<input type='text' id='topic' name='topic' size='100' />
<p>Content: </p>
<textarea id='content' name='content'></textarea><br />
<input type='submit' value='add new post' /></form>";
} else {
echo "<p>please login first or <a href='/forum-tutorial/register.html'>click 
here</a> to register.</p>";
}
?>
</div>
</div>
</body>
</html>

这是来自“newtopic.php”

<?php
include ('dbconn.php');

$newuser = $_POST['usernameinput'];
$newpwd = $_POST['passwordinput'];

$insert = mysqli_query($con, "INSERT INTO users (`username`, `password`) 
VALUES ('".$newuser."', '".$newpwd."');");

if ($insert) {
    header("Location: /forum-tutorial/reg-success");
}
?>

这是来自“addnewtopic.php”。

任何帮助表示赞赏。

标签: php

解决方案


推荐阅读