Re: Javascript Alert

From: Date: Thu, 26 Oct 2000 04:52:33 +0000
Subject: Re: Javascript Alert
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-22048@lists.php.net to get a copy of this message
I just saw David's post in this thread saying that PHP is server side, while JavaScript is client side-- he's quite right. In order for my code snippet below to work, it would have to be on the receiving end of the form, after it was submitted. It would work, but it would be kinda weird to have JavaScript alerts popping up _after_ the form was actually submitted... See ya, JRB Jay Beaton <jrb@leagueoffice.com> wrote: > > I think what you want to do is... > > <? > if (!$fn || !$age) { > ?> > <script language="javascript"> > <!-- > alert("Please fill in all the fields"); > //--> > </script> > <? > } > ?> > > See ya, > JRB > > LeagueOffice.com Fantasy Sports > > ------------------------------------------ > http://www.leagueoffice.com > > as cool as fantasy sports get... > ------------------------------------------ > sannec27@eng.uab.edu wrote: > > > > Hi all, > > > > I am having a simple form which collects the age and name of the > users. The > > names of First Name and Age fields are fn and age respectively. i > want to > > pop up an alert box if somebody doesn't fill any of the two fields. I > am > > trying with the following code but it is somehow not working: > > > > if (!$fn || !$age) > > <?php > > echo \"javascript:alert(\'Please fill in all the fields\')\"; > > ?> > > > > Can any one please tell me what's the error in this line is. > > > > thanks > > Chakravarthy K Sannedhi > > -- ls

« previous php.general (#22048) next »