Re: call php with javascript

From: Date: Tue, 27 Nov 2001 14:43:54 +0000
Subject: Re: call php with javascript
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-75785@lists.php.net to get a copy of this message
I don't get what you are trying to do. Does test.php contain JavaScript that you are trying to execute? If so, then test.php should be called test.js, and should look something like this: function (blah) {
        var foo = blah;
        document.write(foo);
} If test.php is a PHP document that you're trying to execute, then your main document should look like this: <?
        include("test.php");
?> ...and it should be called something like myDocument.php. The problem is that PHP is a server-side language and you're trying to force it to execute like a browser-side language. It won't work. <?rant IE is far too forgiving of the inclusion of bad code, which is why I never recommend that it be used for testing purposes -- in my experience, developers who develop for IE or who test on IE universally create bad code, because IE just lets it happen. Use Netscape for testing your pages; if it works in Netscape, it will work in IE and Opera and Mozilla, etc. If it works in IE, it may or may not work in other browsers. ?> At 03:36 AM 11/27/2001, Bas Jobsen wrote:
Hi, i have test.php: <? echo "test"; ?> to call this in the html, i use <SCRIPT LANGUAGE="Javascript" SRC="test.php"></script> this works fine for IE, but is there an alternative for Netscape to do this? Tnx, Bas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
Sliante, Richard S. Crawford http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford MSN: underpope@hotmail.com "It is only with the heart that we see rightly; what is essential is invisible to the eye." --Antoine de Saint Exupéry "Push the button, Max!"

« previous php.general (#75785) next »