prob with "nested java"
| From: | Shane McBride | Date: | Fri, 10 Nov 2000 01:34:02 +0000 |
| Subject: | prob with "nested java" | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-24598@lists.php.net to get a copy of this message | ||
I want to validate a text field before submission. Here's what I have:
<form action="<? $PHP_SELF ?>" name="test">
Name: <input type="text" name="name" size=30>
<input type="submit" value="Testing">
<?
if (!($name)) {
echo "<SCRIPT> alert('Enter a name'); </SCRIPT>";
} else {
echo "This will do something in the future...";
}
?>
When I call this file in a broswer, it immediate pops up the Alert box. How do I get past this?
Secondly, it does not work in Netscape when you do enter a name and submit it.
Any ideas?
Here's a link: www.rditech.net/php/validate.php
TIA,
Shane