所以当你按下"注册"这个弹出窗口出现
<div class='warn-splash-bg'>
<div class='warn-splash'>
<span class='fa-stack fa-4x' style='color: #C7B017; margin-top: 10px;'>
<i class='fa fa-circle-thin fa-stack-2x'></i>
<i class='fa fa-cog fa-spin fa-stack-1x'></i>
</span>
<h2 class='warn-main basic-font'>Warning:</h2>
<p class='warn-desc basic-font'>By joining this site you agree to the Terms Of Service</p>
<input type='submit' value='Agree' class='tos-agree-btn' name='agree-tos' />
<input type='button' value='Decline' class='tos-decline-btn' />
</div>
</div>
由于某种原因,当此弹出窗口出现时,它会清除页面上您需要填写的其他输入以创建帐户。因此,使它无法正常工作。
//php
if ($agree) {
session_start();
$_SESSION['username'] = $user;
$_SESSION['hash'] = $encrypt;
$data1 = "INSERT INTO users
(username, password, email, ip, datecreated)
VALUES (:username, :password, :email, :ip, :datecreated)";
$data2 = $handler->prepare($data1);
$data2->execute(array(':username' => $username,
':password' => $encrypt,
':email' => $email,
':ip' => $ip,
':datecreated' => $date)
);
$giveEmeralds = $handler->query("UPDATE users SET emeralds=5 WHERE username='$username'");
header("Location: ../");
exit();
}
答案 0 :(得分:0)
您必须拥有一个表单,其中包含您提及的输入。您可以向提交该表单的提交中添加javascript事件:
<input type='submit' value='Agree' class='tos-agree-btn' name='agree-tos' onclick='document.getElementById("yourFormId").submit(); return false;' />