Re: prob with "nested java"
| From: | Reuben D Budiardja | Date: | Fri, 10 Nov 2000 03:51:10 +0000 |
| Subject: | Re: prob with "nested java" | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-24616@lists.php.net to get a copy of this message | ||
Change your if statement to :
<?
if (!($name) && $submit=="Testing" ) {
echo "<SCRIPT> alert('Enter a name'); </SCRIPT>";
} else {
echo "This will do something in the future...";
}
?>
I think that should work just fine.
Reuben D. Budiardja
At 08:34 PM 11/9/00 -0500, Shane McBride wrote:
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