如果您的PHP页面变为空白,原因是什么 [英] What is the cause if your PHP page goes blank
问题描述
这是我,这是我的assignemet试图修复这个PHP脚本很长一段时间
首先开始,它发出错误,
hi it is me again, this is my assignemet been trying to fix this php script for a long time
first to begin, it was issuing an error,
Warning: join(): Invalid arguments passed in C
这是第一个错误
,第二个错误是:通知:c中的未定义索引。
如果我的html代码,我在注册时注册了一些值,但在我的php中代码我输入了,所以我修正了
现在我修完它后,我试着注册一个用户,现在我得到一个空白页面,不要知道是什么原因但也许第三只眼睛可以看到我不能。请帮助
这是我试过的。
我尝试过的事情:
this is the first error
and the second error was: notice: undefined index in c.
apprently if my html code, i had register a the values when registering but in my php code i had enter instead, so i fix it right
now after i finished fixing it, i tried to register a user and now i am getting a blank page, dont know what is the cause but maybe a third eye can see what I cant. please help
here is what i have tried.
What I have tried:
<pre><?php
//$register=$_POST['register_user'];
if(isset($_POST['register']))
{
//capture the variable from the form and store in php variables
$title=$_POST['title'];
$firstname=$_POST['fname'];
$lastname=$_POST['lname'];
$username=$_POST['username'];
$email=$_POST['email'];
$gender=$_POST['gender'];
$service= join(", ", $_POST['services']);
$address=$_POST['address'];
$mypwd=$_POST['mypwd'];
include'db_server.php';
//Query the database
$sql="SELECT * FROM members WHERE username='$username'";
$result= mysqli_query($conn, $sql) or die ("ERROR:" .mysqli_error($conn));
$rowcount=mysqli_num_rows($result);
//checking to see if username is already exist
if($rowcount >= 1)
{
echo "<script type=\"text/javascript\">
alert('Username already exits');
window.location=\"../xhtml/register_user.html\";
</script>";
}
else
{
//insert data into table
$sql = "INSERT INTO members
VALUES('$title', '$firstname', '$lastname', '$username', '$email', '$gender', '$service', '$address', md5('$mypwd'))";
if(mysqli_query($conn,$sql))
{
echo "<script type=\"text/javascript\">
alert('Welcome!! $firstname $lastname, you are now a member of the Caribbean Nature Seekers Institute TT(CNSITT)');
window.location=\"../index.html\";
</script>";
mysqli_close($conn);
}
else
{
echo "Error inserting values into database";
}
//end of line
}
}
?>
推荐答案
register =
register=
_POST ['register_user'];
if(isset(
_POST['register_user']; if(isset(
_POST [' 注册']))
{
// 捕获来自表单的变量并存储在php变量中
_POST['register'])) { //capture the variable from the form and store in php variables
这篇关于如果您的PHP页面变为空白,原因是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!