试图显示电子邮件和密码写在电子邮件和密码输入的问题


trying to show the email and password Written in email and password inputs issue

我试图在'<pre></pre>'中显示在表单中传递的值。但是它不工作,给我一些错误:

-> 注意:未定义索引:email in

-> 注意:未定义index: pass

-> 注意:未定义索引:remember

我已经试过这样放isset:

$f['email'] = mysql_real_escape_string(isset($_POST['email']));
$f['pass'] = mysql_real_escape_string(isset($_POST['pass']));
$f['save'] = mysql_real_escape_string(isset($_POST['remember']));

这样就没有错误了但是我在表单输入中写入的数据没有显示在

echo '<pre class="debug">';
print_r($f);
echo '</pre>';

你能看出我做错了什么吗?

我代码:

 <?php
            if(isset($_POST['sendLogin']))
            {
                $f['email'] = mysql_real_escape_string($_POST['email']);
                $f['pass'] = mysql_real_escape_string($_POST['pass']);
                $f['save'] = mysql_real_escape_string($_POST['remember']);
                echo '<pre class="debug">';
                print_r($f);
                echo '</pre>';
            }
        ?>

    <?php
        if(!isset($_GET['remember']))
        {
        ?>
        <form name="login" action="" method="post">
            <label>
                <span>Email:</span>
                <input type="text" class="radius" name="<?php if($f['email']) echo $f['email']; ?>" />
            </label>
            <label>
                <span>Password:</span>
                <input type="password" class="radius" name="<?php if($f['pass']) echo $f['pass']; ?>" />
            </label>
            <input type="submit" value="Login" name="sendLogin" class="btn" />
            <div class="remember">
                <input type="checkbox" name="remember" value="1" 
            <?php if(isset($f['save'])) echo 'checked="checked"' ?> 
/> 

我认为你在name属性上犯了错误。输入中应该有静态name="email"和name="pass"。当您当前的name属性更改为value:

<input type="text" class="radius" name="email" value="<?php if($f['email']) echo $f['email']; ?>" />
<input type="password" class="radius" name="pass" value="<?php if($f['pass']) echo $f['pass']; ?>" />

您的输入必须具有name属性以便在PHP中可访问

<form name="login" action="" method="post">
            <label>
                <span>Email:</span>
                <input type="text" class="radius" value="<?php if($f['email']) echo $f['email']; ?>" name="email" />
            </label>
            <label>
                <span>Password:</span>
                <input type="password" class="radius" value="<?php if($f['pass']) echo $f['pass']; ?>" name="password" />
            </label>
            <input type="submit" value="Login" name="sendLogin" class="btn" />
            <div class="remember">
                <input type="checkbox" name="remember" value="1" 
            <?php if(isset($f['save'])) echo 'checked="checked"' ?> 
/> 

<input type="text"><input type="password">块中,为name属性提供一个有意义的值。这里在你的代码提供name="email"和下一个name="pass"。此外,要在表单提交后显示email/pass值,请在value属性中给出它。现在你错误地给了里面的name属性。

value= "<?php if($f['email']) echo $f['email']; ?>" and

value= "<?php if($f['pass']) echo $f['pass']; ?>"