Re: php and javascript

From: Date: Tue, 18 Mar 2003 22:59:32 +0000
Subject: Re: php and javascript
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-140218@lists.php.net to get a copy of this message
----- Original Message ----- From: "Antoine" <asolomon15@nyc.rr.com> To: "php list" <php-general@lists.php.net> Sent: Tuesday, March 18, 2003 3:52 PM Subject: [PHP] php and javascript > I wrote a function to redirect my page to another one. But for some > reason I keep getting an error. > here is the function I made > > function js_pointer_login($thepage) > { > echo '<script language="javascript"> window.location = > '$thepage' > </script>'; > } > > > -- > Antoine <asolomon15@nyc.rr.com> Three fundemental flaws: 1) single quotes in PHP denote a litteral string so $thepage will not be parsed 2) the first single quote before $thepage will end the echo statement anything after that is a parse error 3) the proper javascript syntax to redirect to a url within the active window is window.location.href=""; - Kevin

« previous php.general (#140218) next »