angularjs 角形提交

jljoyd4f  于 2022-11-21  发布在  Angular
关注(0)|答案(2)|浏览(115)

目前尝试建立注册表单时,我遇到问题:注册工作正常,直到我添加代码来检查字段是否设置正确。

if( !$username12 or !$password12 or !$email or !$habbo ) {

                        echo "
<div class=\"alert alert-danger\">
  <strong>Error!!</strong> Please Try again
</div>" 

                    } else {

$db->query( "INSERT INTO `users`(`id`, `username`, `password`, `email`, `habbo`, `skype`, `location`, `displaygroup`, `usergroups`) VALUES (NULL, '{$username12}', '{$password_enc}', '{$email}', '{$habbo}', '{$skype}', '{$location}', '1', '1')");
echo "
<div class=\"alert alert-success\">
  <strong>Success!</strong> Our intern Steven recieved your request! 
</div>" 
}
?>

这是我的JS文件
第一次
下面是register_submit. php的代码

<?php
require_once( "../staff/staff/_inc/glob.php" );
$password12 = $_POST['password12'];
$username12 = $_POST['username12'];
$password_enc = $core->encrypt( $password12 );
$email = $_POST['email'];
$habbo = $_POST['habbo'];
$skype = $_POST['skype'];
$location = $_POST['location'];

$query3 = $db->query( "SELECT * FROM users WHERE username = '{$username12}'" );
$array3 = $db->assoc( $query3 );

$query4 = $db->query( "SELECT * FROM users WHERE email = '{$email}'" );
$array4 = $db->assoc( $query4 );

$query5 = $db->query( "SELECT * FROM users WHERE habbo = '{$habbo}'" );
$array5 = $db->assoc( $query5 );

if( !$username12 or !$password12 or !$email or !$habbo ) {
echo "<div class=\"alert alert-danger\"><strong>Error!!</strong> Please Try again</div>" 

                } else {

$db->query( "INSERT INTO `users`(`id`, `username`, `password`, `email`, `habbo`, `skype`, `location`, `displaygroup`, `usergroups`) VALUES (NULL, '{$username12}', '{$password_enc}', '{$email}', '{$habbo}', '{$skype}', '{$location}', '1', '1')");
echo "<div class=\"alert alert-success\"><strong>Success!</strong> Message! </div>" }?>

如果我删除If和else标签,提交就可以正常工作,但是如果有了它们,表单就不能提交了。这是我的语法问题还是别的什么问题?

jckbn6z7

jckbn6z71#

我可能是错的,但请尝试将“or”替换为||

c0vxltue

c0vxltue2#

你没有“;“的值。
为了消除引号(“)和转义序列造成的混淆,请用途:

echo '<div class="alert alert-danger"><strong>Error!!</strong> Please Try again</div>';

相关问题