amir4oracle
Programmer
The following code has a javascript function commalrt() instead giving the alert it echos: javascript: commalrt() in the window how can i invoke the javascript fn from php
The Code is:
<html>
<head>
<script language="javascript">
function commalrt() {
alert ('You forgot to enter Comment');
}
</script>
</head>
<body>
<?php
.
.
if (empty($_POST['comments']))
echo "javascript: commalrt()";
.
.
?>
.
.
<input type="text" name="comments" size="15" value="<?php echo $_POST['comments']; ?>"/>
.
.
</body>
</html>
.
.
<input type="text" name="comments" size="15" value="<?php echo $_POST['comments']; ?>"/>
.
.
</body>
</html>
The Code is:
<html>
<head>
<script language="javascript">
function commalrt() {
alert ('You forgot to enter Comment');
}
</script>
</head>
<body>
<?php
.
.
if (empty($_POST['comments']))
echo "javascript: commalrt()";
.
.
?>
.
.
<input type="text" name="comments" size="15" value="<?php echo $_POST['comments']; ?>"/>
.
.
</body>
</html>
.
.
<input type="text" name="comments" size="15" value="<?php echo $_POST['comments']; ?>"/>
.
.
</body>
</html>