Javascript 使用模态对话框登录表单让我登录php函数

Javascript 使用模态对话框登录表单让我登录php函数,javascript,php,jquery,html,twitter-bootstrap,Javascript,Php,Jquery,Html,Twitter Bootstrap,我想做的是,当我选中对话框中的复选框按钮时,我在上面键入的电子邮件和密码将被保存并重定向到profile.php 我的问题是它不工作,输入框中有一个错误,上面写着: 未定义索引:unm和未定义索引:pwd 这里有人能帮我解决问题吗 PHP: window.location=“profile.php”; HTML: &时代; 请输入您的电子邮件地址和密码以登录。 电子邮件 在回显之前,首先检查是否在html中设置了$\u COOKIE['pwd']或$\u COOKIE['unm']: if

我想做的是,当我选中对话框中的复选框按钮时,我在上面键入的电子邮件和密码将被保存并重定向到profile.php

我的问题是它不工作,输入框中有一个错误,上面写着:

未定义索引:unm和未定义索引:pwd

这里有人能帮我解决问题吗

PHP:


window.location=“profile.php”;
HTML:


&时代;
请输入您的电子邮件地址和密码以登录。
电子邮件

在回显之前,首先检查是否在html中设置了$\u COOKIE['pwd']或$\u COOKIE['unm']:

if(isset($_COOKIE['pwd']) && !empty($_COOKIE['pwd'])){
    $pwd = $_COOKIE['pwd'];
}else{
    $pwd = '';
}
//same for unm 

if(isset($_COOKIE['unm']) && !empty($_COOKIE['unm'])){
    $unm = $_COOKIE['unm'];
}else{
    $unm = '';
}
那么输入应该是:

<input type="text" name="email" value="<?php echo $unm ?>" class="form-control" placeholder="Enter Email Address..." />                                    
 //same for pass 
<input type="password" name="password" value="<?php echo $pwd ?>" class="form-control" placeholder="Enter Password..." /> 

由于您的表单具有
$\u COOKIE['unm']
,因此出现未定义的索引错误,但如果尚未设置COOKIE,则尚未设置该索引(
unm
)。
if(isset($_COOKIE['pwd']) && !empty($_COOKIE['pwd'])){
    $pwd = $_COOKIE['pwd'];
}else{
    $pwd = '';
}
//same for unm 

if(isset($_COOKIE['unm']) && !empty($_COOKIE['unm'])){
    $unm = $_COOKIE['unm'];
}else{
    $unm = '';
}
<input type="text" name="email" value="<?php echo $unm ?>" class="form-control" placeholder="Enter Email Address..." />                                    
 //same for pass 
<input type="password" name="password" value="<?php echo $pwd ?>" class="form-control" placeholder="Enter Password..." />