Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.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,您好,我的表格有问题,我不知道为什么我还没有填写完整的表格。我看不出我做错了什么,你能帮我吗 <?php if(isset($_POST['submit'])) { $username = mysqli_real_escape_string($_POST['username']); $password1 = mysqli_real_escape_string($_POST['password1']); $password2 =

您好,我的表格有问题,我不知道为什么我还没有填写完整的表格。我看不出我做错了什么,你能帮我吗

<?php
    if(isset($_POST['submit']))
    {
        $username = mysqli_real_escape_string($_POST['username']);
        $password1 = mysqli_real_escape_string($_POST['password1']);
        $password2 = mysqli_real_escape_string($_POST['password2']);
        $email = mysqli_real_escape_string($_POST['email']);

        if (!empty($username) && !empty($password1) && !empty($password2) && !empty($email) && ($password1 == $password2) ) 
        {

            //my code

        }
        else
        {
            echo "u wot m8?!";
        }

<form id="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <input type="text" id="username" name="username" placeholder="Your nickname" maxlength="15" /><br />  
    <div id="check_av"></div> 
    <input type="password" id="password1" name="password1" placeholder="Your password" /><br />
    <input type="password" id="password2" name="password2" placeholder="Retype password" /><br />
    <input type="text" id="email" name="email" placeholder="Your email address" /><br />
    <input type="submit" id="submit" value="Sign up" name="submit" />
</form>

我想说
mysqli\u real\u escape\u string
出错了,因为它没有数据库连接,这是它所需的第一个参数()

NULL
empty
因此,请先设置数据库连接,或者在有数据库连接时退出


这个故事的寓意是:

我想说
mysqli\u real\u escape\u string
出错了,因为它没有数据库连接,这是它所需的第一个参数()

NULL
empty
因此,请先设置数据库连接,或者在有数据库连接时退出


这个故事的寓意:

错误是“u wot m8?!”,所以它说我没有填写整个表单,因为如果我有我的代码,但它甚至没有进入这个if。错误是“u wot m8?!”,所以它说我没有填写整个表单,因为如果我有我的代码,但它甚至没有进入这个如果。很好,我只是看着那个我的自我:)很好,我只是看着那个我的自我:)
$ php -r 'var_dump( mysqli_real_escape_string("something"));'
Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in Command line code on line 1

Call Stack:
    0.0002     130868   1. {main}() Command line code:0
    0.0002     130924   2. mysqli_real_escape_string() Command line code:1

NULL