Click to See Complete Forum and Search --> : php: creating alert


casy
05-08-2003, 09:03 PM
I am new to using PHP, i like to know how can i create an alert box similar to those created in javascript??

pyro
05-08-2003, 09:10 PM
PHP runs server side, so you can't make an alert with it. You can use PHP to write a javascript alert though, or just echo some text to the screen...

casy
05-08-2003, 10:04 PM
thx, think i got it, u mean to jump put of php and write a javascript statement for the alert rite??

just another question, if i were to get an error that says:

syntax error near unexpected token `<html>'

what does it mean?? or how should i solve it??:confused:

pyro
05-08-2003, 10:14 PM
1. Yes, either jump out of PHP, or write it using PHP using echo or print

2. Post the code that is giving you trouble...

casy
05-08-2003, 10:22 PM
this is the code:

<html>
<head>
<title>Admin Login</title>
</head>
<body bgcolor=#F0FFFF>
<?
$user=$HTTP_POST_VARS["user"];
$password=$HTTP_POST_VARS["password"];

if(empty($user)||empty($password))
{
?>
<script language="javascript">
<!--
alert("Login Error!!! Please check your login details and login again.");
//-->
</script>
<?
}
?>
</body>
</html>

casy
05-09-2003, 11:30 PM
Thx anyway, I've solved it:)