嗨,我是PHP新手,对我来说一切都非常混乱。我试图做的和失败的是在页面上点击一个按钮时在屏幕上显示一个警报。用PHP显示jQuery提醒
我的代码signInFunction.php:
<?php
if(isset($_POST['signIn'])){
if(isset($_POST['username']) and isset($_POST['password'])){
$username = $_POST['username'];
$password = $_POST['password'];
?>
<script type="text/javascript">alert("test");</script>
<?php
echo "username is: ".$username." and password is: ". $password;
}
else{
echo "Please enter username and password";
}
}
else{
echo "error button";
}
?>
在index.php文件
看起来是这样的:
<?php include "includes/header.php" ?>
<?php include "includes/navbar.php" ?>
<?php include "includes/carousel.php"?>
<?php include "includes/marketing.php"?>
<?php include "includes/features.php"?>
<?php include "includes/hidden.php"?>
<?php include "includes/footer.php" ?>
<?php include "includes/functions/signinFunction.php"?>
的问题是,我管理底部显示的数据,但未能让警报出现..我错过了什么?
[回荡在php jquery的警报弹出]的可能的复制(http://stackoverflow.com/questions/16532338/echoing-a-jquery-alert-popup-in-php) – swidmann
@swidmann OP正在使用问题中描述的方法之一。不是重复的imho。 –
您是否检查页面源代码?你看到你的警报功能吗?浏览器报告你一些JS错误或什么? – MilanG