Re: [PHP] PHP and javascript
To do what you want that new httpd server should at least be able to call up PHP via cli / whatever, and retrieve the output. It also needs to provide what's in php called $_GET and $_POST. Assuming you got that covered, then yes, you could route the calls via ajax (i recommend jquery.com for that) to your non-php httpd, which then forwards it (and the results back). What i'd do if it HAD to be done this way, is pass a couple of extra variables in each call from javascript. It's best to route all the ajax calls to php to the same script on the non-php httpd, so you'd need at least the relative path (from serverside defined absolute base-path for your php subsystem) to the script being called (or even an MD5/SHA256 of this rel path, if you're on the paranoid side; you then inform (via an array) the non-php httpd about all the scripts that may be called from javascript, without giving up the scripts names to spies along the line) But tbh, whoever thought of changing the type of server used and thereby giving you this new problem, should have also thought of how to not-dump tons of existing code. Not to mention developer experience with a specific language. If this new httpd is so damn good at something that it has to be used, it still doesn't mean it has to be used for the entire system either. You might be giving it more work than it is comfortable with, that way. So depending on your backend size (in terms of number of machines used) setup, you might even campaign to keep an apache in the picture and let it perform work on the database / file storage system.. On Fri, Jan 15, 2010 at 8:07 PM, Andres Gonzalez and...@packetstorm.com wrote: How do I call PHP code that will run server side, from javascript code that is running client side? I have a lot of PHP server side code written and working within CodeIgniter. Now, my project has changed and (for reasons unimportant to this discussion) we are now NOT going to use apache and CodeIgniter, but instead, we are going to have to use an http server that does not support PHP internally. But I want to reuse my original PHP code. So I am thinking that I can execute the PHP code via a command line interface using the PHP cli interface instead of the PHP cgi interface. But, I will have to initiate this serversid call via javascript code running on the client. I know...kind of convoluted. But how would one do this if necessary? -Andres -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and javascript
oh, and if you're going to use ajax-non-phphttpd-php-andback, then check if your dear non-php httpd abuses the CPU while waiting for PHP to return the results... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and javascript
I don't think you can call php cli from client javascript unless you have a wrapper http interface On Fri, Jan 15, 2010 at 2:07 PM, Andres Gonzalez and...@packetstorm.comwrote: How do I call PHP code that will run server side, from javascript code that is running client side? I have a lot of PHP server side code written and working within CodeIgniter. Now, my project has changed and (for reasons unimportant to this discussion) we are now NOT going to use apache and CodeIgniter, but instead, we are going to have to use an http server that does not support PHP internally. But I want to reuse my original PHP code. So I am thinking that I can execute the PHP code via a command line interface using the PHP cli interface instead of the PHP cgi interface. But, I will have to initiate this serversid call via javascript code running on the client. I know...kind of convoluted. But how would one do this if necessary? -Andres -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and javascript
On Fri, 2010-01-15 at 14:07 -0500, Andres Gonzalez wrote: How do I call PHP code that will run server side, from javascript code that is running client side? I have a lot of PHP server side code written and working within CodeIgniter. Now, my project has changed and (for reasons unimportant to this discussion) we are now NOT going to use apache and CodeIgniter, but instead, we are going to have to use an http server that does not support PHP internally. But I want to reuse my original PHP code. So I am thinking that I can execute the PHP code via a command line interface using the PHP cli interface instead of the PHP cgi interface. But, I will have to initiate this serversid call via javascript code running on the client. I know...kind of convoluted. But how would one do this if necessary? -Andres I wouldn't recommend doing it this way at all. What you'd essentially need, is Javascript make an AJAX request to a server script, which would then call your PHP shell script, which would then return data to the [other language] server script, that responds back to the Javascript on the browser. What sort of server will you be using that you can' support PHP on it? PHP runs on most web servers out there, and will happily run alongside other language modules on a single server. Who's making the decisions about the new server? Someone really needs to explain to him/her that it's a massive project converting a website from one language to another (I've had to convert a large ColdFusion one to PHP before, so I know) and it will probably cost more in the long term to convert than might be saved on whatever server 'deal' they're getting. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] php image javascript issue
In my test.php file, I cannot run javascript and images do not show up. If I run this file using the URL http://localhost/index/?m=loginname=Sachin I can see 'My name is Sachin'. If I rename this file to test.html and open it, the image shows up and clicking on 'Click Me!' button works fine. Pls uncomment the tag when you run it. === html head meta http-equiv=Content-Type content=text/html; charset=windows-1252 titleSPIDR/title script src=javascript/test.js language=javascript /script link href=style.css rel=stylesheet type=text/css /head body bgcolor=#FF leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 !-- pls un comment it to test it -- !-- images/login.png -- pinput type=button name=TEST onclick=Hello() value=Click Me! //p ?php $name = $_GET['name']; echo 'My name is ' . $name; ? /body /html === test.js function Hello() { alert('Hello Ronaldo'); } == -- View this message in context: http://www.nabble.com/php-image---javascript-issue-tp19376008p19376099.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript error
When you install IE, I think there is an option to get the developer JS tools that give better error messages... And there's some kind of setting in the preferences about showing JS errors. And maybe a JS console. Havent' used IE for so long, I forget what all there is, but I suspect you can wring out more info, once you go through enough interminible dialogs from MS. Also check in Firefox JS console -- It may be warning you of a problem without halting on it. On Wed, March 7, 2007 11:03 am, Németh Zoltán wrote: 2007. 03. 7, szerda keltezéssel 10.59-kor Ed Curtis ezt Ãrta: I've just run into this problem this morning a href=# onclick=javascript:window.open('web_forward.php?address=? echo $web_url; ?agent=? echo $agent; ?real_company_name=? echo $real_company_name; ?', 'Web Site'); This produces an Error on Page in IE 7, but works perfectly in Firefox and Netscape. I have several other javascript calls on the page where this call resides and all of them work perfectly except for this one. Does this error occur because I'm sending the variables to another script that does some logging then forwards the user to the URL or is it just a IE quirk? I'm almost sure it has nothing to do with php rather javascript, and maybe microsoft's special javascript interpretations... greets Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript error
On Thu, March 8, 2007 7:17 pm, jekillen wrote: Yes I have been around the bend with Netscape and now, Fire Fox javascript consoles. Before I got it that I need to format web content text for Unix, I went crazy trying to interpret Netscape console messages and the line numbers it said the errors were found. I was using Mac and text file are formatted with carriage return, not new line or line feed as in Unix text. The Javascript errors are based on Unix text formatting even if the browser is running on Mac or Windows (well I am not sure about Windows, I have never use it for web development but I do know that it uses both carriage return and line feed for plain text line endings). The line numbers correspond to your HTML output lines, not PHP lines. You may also want to tack on \n for most PHP print/echo statements, so that the HTML source is nicely formatted. Between JavaScript console and View Source you can almost always track back to what PHP spit out what, unless your PHP code is a pig's breakfast to start with. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php and javascript error
On Sun, March 11, 2007 9:21 am, tedd wrote: At 5:28 PM +0100 3/7/07, [EMAIL PROTECTED] wrote: PS: If you want your code to validate, change the to amp; Add the closing /a tag too. PPS: It's advisable not to use the short tags, use ?php instead of ? in such a cases I usually use ?= $var ? instead ?php echo $var ?. At least it's shorter. :) -afan But, while it's shorter, it's still NOT advisable to use the shorter tags. I believe short tags is/was/maybe slated for removal completely in PHP 6... That may have been shot down. Or maybe ?= is kept, while the generic ? is going away... I kinda LIKE ?= personally, but not enough to risk using it if I'll have to rewrite a zillion lines of code in a few years. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php and javascript error
At 5:28 PM +0100 3/7/07, [EMAIL PROTECTED] wrote: PS: If you want your code to validate, change the to amp; Add the closing /a tag too. PPS: It's advisable not to use the short tags, use ?php instead of ? in such a cases I usually use ?= $var ? instead ?php echo $var ?. At least it's shorter. :) -afan But, while it's shorter, it's still NOT advisable to use the shorter tags. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript error
On 3/11/07, tedd [EMAIL PROTECTED] wrote: At 5:28 PM +0100 3/7/07, [EMAIL PROTECTED] wrote: PS: If you want your code to validate, change the to amp; Add the closing /a tag too. PPS: It's advisable not to use the short tags, use ?php instead of ? in such a cases I usually use ?= $var ? instead ?php echo $var ?. At least it's shorter. :) -afan But, while it's shorter, it's still NOT advisable to use the shorter tags. tedd It does save space on your harddrive (Not much, but some :P) and if it is for your own usage only, why not? Tijnema -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript error
At 3:25 PM +0100 3/11/07, Tijnema ! wrote: On 3/11/07, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: At 5:28 PM +0100 3/7/07, mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: PS: If you want your code to validate, change the to amp; Add the closing /a tag too. PPS: It's advisable not to use the short tags, use ?php instead of ? in such a cases I usually use ?= $var ? instead ?php echo $var ?. At least it's shorter. :) -afan But, while it's shorter, it's still NOT advisable to use the shorter tags. tedd It does save space on your harddrive (Not much, but some :P) and if it is for your own usage only, why not? Tijnema Tijnema: Saves space? I would venture to say that if you took the inverse of the space that technique saves from a typical drive and turn it into dollars, we all (the entire world) could live the rest of our lives very comfortably. Another way to look at it, I would venture to say, if you took the total actual cost for the space everyone (all php programmers together) saved from a lifetime of work, you couldn't buy a cup of coffee with it. So, the old let's save space legacy concern doesn't mean squat anymore and it's meaning less squat each day. opinion It's a matter of style and consistency not to use short tags. Don't develop bad-habits when you can easily avoid them. Plus, while we develop code for ourselves, we seldom stay in that environment and when we do venture out, we often take those bad habits with us. Why do it wrong? Also for me, adding php to a short tag is just a reminder of what language I'm currently using and that certainly doesn't inconvenience me a bit -. Besides, it provides me with some degree of comfort in that if I want to move my code publicly, or portions of it, I don't have to worry about past bad habits. After decades of programming, I have enough of those. /opinion Additionally, while I have not dealt with xml yet, I have read that there is a problem in dealing with xml if you use the php short tag regardless of if you're coding for yourself or not. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript error
On Mar 7, 2007, at 11:46 PM, Tijnema ! wrote: Just a little side note, you said that firefox wasn't giving an error, i think it does, but that it hides the error. Open your page, and then go to Tools-javascript console. There it will display all javascript errors. And gives a nice detailed error. Tijnema Thanks, Yes I have been around the bend with Netscape and now, Fire Fox javascript consoles. Before I got it that I need to format web content text for Unix, I went crazy trying to interpret Netscape console messages and the line numbers it said the errors were found. I was using Mac and text file are formatted with carriage return, not new line or line feed as in Unix text. The Javascript errors are based on Unix text formatting even if the browser is running on Mac or Windows (well I am not sure about Windows, I have never use it for web development but I do know that it uses both carriage return and line feed for plain text line endings). Jeff K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript error
2007. 03. 7, szerda keltezéssel 10.59-kor Ed Curtis ezt írta: I've just run into this problem this morning a href=# onclick=javascript:window.open('web_forward.php?address=? echo $web_url; ?agent=? echo $agent; ?real_company_name=? echo $real_company_name; ?', 'Web Site'); This produces an Error on Page in IE 7, but works perfectly in Firefox and Netscape. I have several other javascript calls on the page where this call resides and all of them work perfectly except for this one. Does this error occur because I'm sending the variables to another script that does some logging then forwards the user to the URL or is it just a IE quirk? I'm almost sure it has nothing to do with php rather javascript, and maybe microsoft's special javascript interpretations... greets Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript error
Open the page with IE 7, and open the source, if it doesn't show any ? or ? tags, then it is a IE problem.. Tijnema On 3/7/07, Németh Zoltán [EMAIL PROTECTED] wrote: 2007. 03. 7, szerda keltezéssel 10.59-kor Ed Curtis ezt írta: I've just run into this problem this morning a href=# onclick=javascript:window.open('web_forward.php?address=? echo $web_url; ?agent=? echo $agent; ?real_company_name=? echo $real_company_name; ?', 'Web Site'); This produces an Error on Page in IE 7, but works perfectly in Firefox and Netscape. I have several other javascript calls on the page where this call resides and all of them work perfectly except for this one. Does this error occur because I'm sending the variables to another script that does some logging then forwards the user to the URL or is it just a IE quirk? I'm almost sure it has nothing to do with php rather javascript, and maybe microsoft's special javascript interpretations... greets Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php and javascript error
I've just run into this problem this morning a href=# onclick=javascript:window.open('web_forward.php?address=? echo $web_url; ?agent=? echo $agent; ?real_company_name=? echo $real_company_name; ?', 'Web Site'); This produces an Error on Page in IE 7, but works perfectly in Firefox and Netscape. I have several other javascript calls on the page where this call resides and all of them work perfectly except for this one. Does this error occur because I'm sending the variables to another script that does some logging then forwards the user to the URL or is it just a IE quirk? This is a JavaScript issue, but may have something to do with the data you are echoing out in PHP. Look at the source in the browser. My guess it that you've got a stay quote mark in one of your PHP vars. Edward PS: If you want your code to validate, change the to amp; Add the closing /a tag too. PPS: It's advisable not to use the short tags, use ?php instead of ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript error
Németh Zoltán wrote: 2007. 03. 7, szerda keltezéssel 10.59-kor Ed Curtis ezt írta: I've just run into this problem this morning a href=# onclick=javascript:window.open('web_forward.php?address=? echo $web_url; ?agent=? echo $agent; ?real_company_name=? echo $real_company_name; ?', 'Web Site'); This produces an Error on Page in IE 7, but works perfectly in Firefox and Netscape. I have several other javascript calls on the page where this call resides and all of them work perfectly except for this one. Does this error occur because I'm sending the variables to another script that does some logging then forwards the user to the URL or is it just a IE quirk? I'm almost sure it has nothing to do with php rather javascript, and maybe microsoft's special javascript interpretations... I know it's not the PHP but rather the JS that's causing it. What I fail to understand is that there are 2 JS calls before, and 2 JS calls after this one in my page and the other 4 work perfectly. They are basically the same call too, just to different scripts. I just wondered if anyone knew why this particular call doesn't work or had come across anything like this. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript error
On 3/7/07, Ed Curtis [EMAIL PROTECTED] wrote: Németh Zoltán wrote: 2007. 03. 7, szerda keltezéssel 10.59-kor Ed Curtis ezt írta: I've just run into this problem this morning a href=# onclick=javascript:window.open('web_forward.php?address=? echo $web_url; ?agent=? echo $agent; ?real_company_name=? echo $real_company_name; ?', 'Web Site'); This produces an Error on Page in IE 7, but works perfectly in Firefox and Netscape. I have several other javascript calls on the page where this call resides and all of them work perfectly except for this one. Does this error occur because I'm sending the variables to another script that does some logging then forwards the user to the URL or is it just a IE quirk? I'm almost sure it has nothing to do with php rather javascript, and maybe microsoft's special javascript interpretations... I know it's not the PHP but rather the JS that's causing it. What I fail to understand is that there are 2 JS calls before, and 2 JS calls after this one in my page and the other 4 work perfectly. They are basically the same call too, just to different scripts. I just wondered if anyone knew why this particular call doesn't work or had come across anything like this. Thanks I think you're not at the right mailing list for this, and btw, it would be a lot easier to find what is going wrong, if you post one of the working ones... Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php and javascript error
I've just run into this problem this morning a href=# onclick=javascript:window.open('web_forward.php?address=? echo $web_url; ?agent=? echo $agent; ?real_company_name=? echo $real_company_name; ?', 'Web Site'); This produces an Error on Page in IE 7, but works perfectly in Firefox and Netscape. I have several other javascript calls on the page where this call resides and all of them work perfectly except for this one. Does this error occur because I'm sending the variables to another script that does some logging then forwards the user to the URL or is it just a IE quirk? This is a JavaScript issue, but may have something to do with the data you are echoing out in PHP. Look at the source in the browser. My guess it that you've got a stay quote mark in one of your PHP vars. Edward PS: If you want your code to validate, change the to amp; Add the closing /a tag too. PPS: It's advisable not to use the short tags, use ?php instead of ? in such a cases I usually use ?= $var ? instead ?php echo $var ?. At least it's shorter. :) -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript error
a href=# onclick=javascript:window.open('web_forward.php?address=? echo $web_url; ?agent=? echo $agent; ?real_company_name=? echo $real_company_name; ?', 'Web Site'); This produces an Error on Page in IE 7, but works perfectly in Firefox and Netscape. I have several other javascript calls on the page where this call resides and all of them work perfectly except for this one. Does this error occur because I'm sending the variables to another script that does some logging then forwards the user to the URL or is it just a IE quirk? This is a JavaScript issue, but may have something to do with the data you are echoing out in PHP. Look at the source in the browser. My guess it that you've got a stay quote mark in one of your PHP vars. Not it, I looked and there's nothing there. PS: If you want your code to validate, change the to amp; Add the closing /a tag too. Thanks, the 's are now all amp;. The closing /a is in the script, just wasn't posted in the message. PPS: It's advisable not to use the short tags, use ?php instead of ? Can you tell me why? Is it just a personal preference? Another JS call directly in front of this one works perfectly. a href=# onclick=javascript:window.open('email.php?mls=? echo $mls; ?amp;toagent=? echo $agent; ?amp;toagentemail=? echo $agent_email; ?amp;tocompanyname=? echo $real_company_name; ?', 'Email', 'width=400,height=400,scrollbars=no,resizable=yes'); Send Me Email /a The only difference is this call has the window options included the one that doesn't work doesn't have them. I've added them just to check and it didn't change anything. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php and javascript error
-Original Message- From: Ed Curtis [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 07, 2007 11:47 AM To: php-general@lists.php.net Subject: Re: [PHP] php and javascript error a href=# onclick=javascript:window.open('web_forward.php?address=? echo $web_url; ?agent=? echo $agent; ?real_company_name=? echo $real_company_name; ?', 'Web Site'); This produces an Error on Page in IE 7, but works perfectly in Firefox and Netscape. Is it because you have given the window the name 'Web Site' which contains a space character? Try naming it 'WebSite' (without the space) Hopefully that is the culprit. I have several other javascript calls on the page where this call resides and all of them work perfectly except for this one. Does this error occur because I'm sending the variables to another script that does some logging then forwards the user to the URL or is it just a IE quirk? This is a JavaScript issue, but may have something to do with the data you are echoing out in PHP. Look at the source in the browser. My guess it that you've got a stay quote mark in one of your PHP vars. Not it, I looked and there's nothing there. PS: If you want your code to validate, change the to amp; Add the closing /a tag too. Thanks, the 's are now all amp;. The closing /a is in the script, just wasn't posted in the message. PPS: It's advisable not to use the short tags, use ?php instead of ? Can you tell me why? Is it just a personal preference? Another JS call directly in front of this one works perfectly. a href=# onclick=javascript:window.open('email.php?mls=? echo $mls; ?amp;toagent=? echo $agent; ?amp;toagentemail=? echo $agent_email; ?amp;tocompanyname=? echo $real_company_name; ?', 'Email', 'width=400,height=400,scrollbars=no,resizable=yes'); Send Me Email /a The only difference is this call has the window options included the one that doesn't work doesn't have them. I've added them just to check and it didn't change anything. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php and javascript error
-Original Message- From: Brad Fuller [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 07, 2007 12:02 PM To: 'Ed Curtis'; 'php-general@lists.php.net' Subject: RE: [PHP] php and javascript error -Original Message- From: Ed Curtis [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 07, 2007 11:47 AM To: php-general@lists.php.net Subject: Re: [PHP] php and javascript error a href=# onclick=javascript:window.open('web_forward.php?address=? echo $web_url; ?agent=? echo $agent; ?real_company_name=? echo $real_company_name; ?', 'Web Site'); This produces an Error on Page in IE 7, but works perfectly in Firefox and Netscape. Is it because you have given the window the name 'Web Site' which contains a space character? Try naming it 'WebSite' (without the space) Hopefully that is the culprit. You should also be making sure to use urlencode() on all data that goes into that URL. a href=# onclick=javascript:window.open('web_forward.php?address=?= urlencode($web_url) ?agent=?= urlencode($agent) ?real_company_name=?= urlencode($real_company_name) ?', 'WebSite') click here /a I have several other javascript calls on the page where this call resides and all of them work perfectly except for this one. Does this error occur because I'm sending the variables to another script that does some logging then forwards the user to the URL or is it just a IE quirk? This is a JavaScript issue, but may have something to do with the data you are echoing out in PHP. Look at the source in the browser. My guess it that you've got a stay quote mark in one of your PHP vars. Not it, I looked and there's nothing there. PS: If you want your code to validate, change the to amp; Add the closing /a tag too. Thanks, the 's are now all amp;. The closing /a is in the script, just wasn't posted in the message. PPS: It's advisable not to use the short tags, use ?php instead of ? Can you tell me why? Is it just a personal preference? Another JS call directly in front of this one works perfectly. a href=# onclick=javascript:window.open('email.php?mls=? echo $mls; ?amp;toagent=? echo $agent; ?amp;toagentemail=? echo $agent_email; ?amp;tocompanyname=? echo $real_company_name; ?', 'Email', 'width=400,height=400,scrollbars=no,resizable=yes'); Send Me Email /a The only difference is this call has the window options included the one that doesn't work doesn't have them. I've added them just to check and it didn't change anything. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php and javascript error
a href=# onclick=javascript:window.open('web_forward.php?address=? echo $web_url; ?agent=? echo $agent; ?real_company_name=? echo $real_company_name; ?', 'Web Site'); This is a JavaScript issue, but may have something to do with the data you are echoing out in PHP. Look at the source in the browser. My guess it that you've got a stay quote mark in one of your PHP vars. Not it, I looked and there's nothing there. I'm sure it's because you've got some stray characters in your output that mess it up. It would help if you actually posted the source rather than just saying it's OK, when it clearly isn't. PPS: It's advisable not to use the short tags, use ?php instead of ? Can you tell me why? Is it just a personal preference? If you move to another server where the short tags option is off, your code will break. From the manual: Using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on PHP servers which are not under your control, because short tags may not be supported on the target server. For portable, redistributable code, be sure not to use short tags. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript error
Ed Curtis wrote: Németh Zoltán wrote: 2007. 03. 7, szerda keltezéssel 10.59-kor Ed Curtis ezt írta: I've just run into this problem this morning a href=# onclick=javascript:window.open('web_forward.php?address=? echo $web_url; ?agent=? echo $agent; ?real_company_name=? echo $real_company_name; ?', 'Web Site'); This produces an Error on Page in IE 7, but works perfectly in Firefox and Netscape. I have several other javascript calls on the page where this call resides and all of them work perfectly except for this one. Does this error occur because I'm sending the variables to another script that does some logging then forwards the user to the URL or is it just a IE quirk? I'm almost sure it has nothing to do with php rather javascript, and maybe microsoft's special javascript interpretations... I know it's not the PHP but rather the JS that's causing it. What I fail to understand is that there are 2 JS calls before, and 2 JS calls after this one in my page and the other 4 work perfectly. They are basically the same call too, just to different scripts. I just wondered if anyone knew why this particular call doesn't work or had come across anything like this. Thanks Sidenote: In new standard of HTML, it's no longer necessary to write onclick=javascript:window.open(. but you could write onclick=window.open(. Could you paste the generated code to show us? You could paste it back to a static page and try again to see what's wrong. -- * Zoner PhotoStudio 8 - Your Photos perfect, shared, organised! www.zoner.com/zps You can download your free version. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript error
Edward Kay wrote: you've got a stay quote mark in one of your PHP vars. Not it, I looked and there's nothing there. I'm sure it's because you've got some stray characters in your output that mess it up. It would help if you actually posted the source rather than just saying it's OK, when it clearly isn't. The problem wasn't a stray apostrophe. Brad Fuller was dead on. It was the space in the window name option of the javascript. It works as expected once the space is removed. PPS: It's advisable not to use the short tags, use ?php instead of ? Can you tell me why? Is it just a personal preference? If you move to another server where the short tags option is off, your code will break. From the manual: Using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on PHP servers which are not under your control My scripts aren't meant for distribution also they will only ever be delpoyed on a server that I control. Thanks for the tip though and thanks to everyone that helped. Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript error
On Mar 7, 2007, at 10:24 AM, Ed Curtis wrote: Edward Kay wrote: you've got a stay quote mark in one of your PHP vars. Not it, I looked and there's nothing there. I'm sure it's because you've got some stray characters in your output that mess it up. It would help if you actually posted the source rather than just saying it's OK, when it clearly isn't. The problem wasn't a stray apostrophe. Brad Fuller was dead on. It was the space in the window name option of the javascript. It works as expected once the space is removed. PPS: It's advisable not to use the short tags, use ?php instead of ? Can you tell me why? Is it just a personal preference? If you move to another server where the short tags option is off, your code will break. From the manual: Using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on PHP servers which are not under your control My scripts aren't meant for distribution also they will only ever be delpoyed on a server that I control. Thanks for the tip though and thanks to everyone that helped. Ed This isn't a javascript discussion list but, javascript and php compliment each other very well. Internet Explorer has error reporting that can be turned on in the preferences. I would try that before making any other assumptions. Believe me, I started developing javascript before php and with no IDE for javascript you 'have to rely on the browsers error reporting facilities, and lots of alert dialogs used as break points. Safari on Mac is a head ache because it has no error reporting at all and I have encountered problems with it that do not show up in any of the browsers that do have error reporting. Hope that helps, Jeff K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript error
Just a little side note, you said that firefox wasn't giving an error, i think it does, but that it hides the error. Open your page, and then go to Tools-javascript console. There it will display all javascript errors. And gives a nice detailed error. Tijnema
Re: [PHP] php generated javascript
On 8/31/06, Curt Zirzow [EMAIL PROTECTED] wrote: On 8/30/06, Shu Hung (Koala) [EMAIL PROTECTED] wrote: On 8/31/06, Peter Lauri [EMAIL PROTECTED] wrote: Koala, There is no difference with the php generated javascript and javascript on a static html page. Take a look at the source code of the page that has been generated in the browser, and if that one looks as it should, it is probably your javascript that is not doing what it should :) And if that is the case you can join the [EMAIL PROTECTED] list for that purpose. /Peter Petar, Thanks for your reply. I've used some server side cache for that javascript generation now. It works a lot better. Seems to me that it takes too long to generate the javascript. Sometimes browsers decided to ignores the javascript and just run. You might want to be more elaborate than that... What is considered longer, What do you mean it ignores the javascript? I used document.write in that javascript. When it isn't loaded completely, nothing shows. I wonder if there is any better way. This i dont understand, perhaps an example of what you are doing? Curt. Curt, I found the problem. I have some \n inside a javascript variable sometimes. That cause the error by chance and I thought that was browser issue. Thanks a lot. Koala Yeung
Re: [PHP] php generated javascript
On 8/30/06, Shu Hung (Koala) [EMAIL PROTECTED] wrote: On 8/31/06, Peter Lauri [EMAIL PROTECTED] wrote: Koala, There is no difference with the php generated javascript and javascript on a static html page. Take a look at the source code of the page that has been generated in the browser, and if that one looks as it should, it is probably your javascript that is not doing what it should :) And if that is the case you can join the [EMAIL PROTECTED] list for that purpose. /Peter Petar, Thanks for your reply. I've used some server side cache for that javascript generation now. It works a lot better. Seems to me that it takes too long to generate the javascript. Sometimes browsers decided to ignores the javascript and just run. You might want to be more elaborate than that... What is considered longer, What do you mean it ignores the javascript? I used document.write in that javascript. When it isn't loaded completely, nothing shows. I wonder if there is any better way. This i dont understand, perhaps an example of what you are doing? Curt. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php generated javascript
Koala, There is no difference with the php generated javascript and javascript on a static html page. Take a look at the source code of the page that has been generated in the browser, and if that one looks as it should, it is probably your javascript that is not doing what it should :) And if that is the case you can join the [EMAIL PROTECTED] list for that purpose. /Peter -Original Message- From: Shu Hung (Koala) [mailto:[EMAIL PROTECTED] Sent: Thursday, August 31, 2006 10:41 AM To: PHP General Users Subject: [PHP] php generated javascript Hello, I'm writing a script to generate a javascript. The javascript would generate a banner when it is sourced. This javascript is sourced by another html like this: script type=text/javascript language='JavaScript' src='http://foo.com/testing/js.php'/script However, Sometimes the javascript doesn't show anything at all. it seems that the php generated javascript cannot be loaded sometimes. Maybe the generation takes too long. I'm not sure about that. Is there anyway to deal with it? Koala Yeung -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php generated javascript
On 8/31/06, Peter Lauri [EMAIL PROTECTED] wrote: Koala, There is no difference with the php generated javascript and javascript on a static html page. Take a look at the source code of the page that has been generated in the browser, and if that one looks as it should, it is probably your javascript that is not doing what it should :) And if that is the case you can join the [EMAIL PROTECTED] list for that purpose. /Peter Petar, Thanks for your reply. I've used some server side cache for that javascript generation now. It works a lot better. Seems to me that it takes too long to generate the javascript. Sometimes browsers decided to ignores the javascript and just run. I used document.write in that javascript. When it isn't loaded completely, nothing shows. I wonder if there is any better way. Koala
Re: [PHP] php generated javascript
put this at the top of your script ob_start(); or before any output. On 8/31/06, Shu Hung (Koala) [EMAIL PROTECTED] wrote: On 8/31/06, Peter Lauri [EMAIL PROTECTED] wrote: Koala, There is no difference with the php generated javascript and javascript on a static html page. Take a look at the source code of the page that has been generated in the browser, and if that one looks as it should, it is probably your javascript that is not doing what it should :) And if that is the case you can join the [EMAIL PROTECTED] list for that purpose. /Peter Petar, Thanks for your reply. I've used some server side cache for that javascript generation now. It works a lot better. Seems to me that it takes too long to generate the javascript. Sometimes browsers decided to ignores the javascript and just run. I used document.write in that javascript. When it isn't loaded completely, nothing shows. I wonder if there is any better way. Koala -- GMail Rocks!!!
Re: [PHP] PHP/CSS/Javascript question
Hi all, Is it possible to modify a table using JavaScript to control CSS visabilty when the entire table is developed dynamically using PHP? Thanks, Paul Paul: I am sure that you can change css via javascript, but you can as well with php -- see: http://www.sperling.com/examples/styleswitch/ tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/CSS/Javascript question
Hi all, Is it possible to modify a table using JavaScript to control CSS visabilty when the entire table is developed dynamically using PHP? Thanks, Paul You don't need to change the CSS (I don't even know if it is possible), but you can change specific styles of any element within the HTML. For example: document.getElementById('IdOfDivContainingTable').style.display='none'; It is particularly usefull to enclose whichever set of elements that you wish to change into a single entity, a DIV or SPAN, if at all possible. Styles assigned in this way have precedence over those from a style sheet Satyam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/CSS/Javascript question
Hi all, Is it possible to modify a table using JavaScript to control CSS visabilty when the entire table is developed dynamically using PHP? Thanks, Paul Satyam said: You don't need to change the CSS (I don't even know if it is possible), but you can change specific styles of any element within the HTML. For example: Yes, it's just a text file -- it can be re-written. However, it needs to be loaded again to take affect. document.getElementById('IdOfDivContainingTable').style.display='none'; It is particularly usefull to enclose whichever set of elements that you wish to change into a single entity, a DIV or SPAN, if at all possible. That's the main principle of ajax, isn't it? Using DOM to apply changes within the document. It might be old-hat to most, but I find it fascinating. Styles assigned in this way have precedence over those from a style sheet The precedence is simply inheritance -- last stated is applied. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/CSS/Javascript question
- Original Message - From: tedd [EMAIL PROTECTED] Hi all, Is it possible to modify a table using JavaScript to control CSS visabilty when the entire table is developed dynamically using PHP? Thanks, Paul Satyam said: You don't need to change the CSS (I don't even know if it is possible), but you can change specific styles of any element within the HTML. For example: Yes, it's just a text file -- it can be re-written. However, it needs to be loaded again to take affect. And it affects all documents of all users. Suddenly, by the action of one user, all other users reaching the same page will see things as per the actions of another user. Unless you take care to keep separate CSS files. document.getElementById('IdOfDivContainingTable').style.display='none'; It is particularly usefull to enclose whichever set of elements that you wish to change into a single entity, a DIV or SPAN, if at all possible. That's the main principle of ajax, isn't it? Using DOM to apply changes within the document. It might be old-hat to most, but I find it fascinating. No, this is not AJAX, it is simply using the DOM. Ajax also involves communication with the server in the background. Styles assigned in this way have precedence over those from a style sheet The precedence is simply inheritance -- last stated is applied. No, if you dynamically load a new stylesheet after you set the style of an element using the DOM, this style would still have precedence over the new stylesheet. The precedence of styles is set by how you set it. Setting a style through the DOM has precedence over CSS attributes, which have precedence over styles specified by the style HTML attribute which has precedence over the default rendering of an element. Only within the same category the order of assignment would matter. And, by the way, yes, you can load a new stylesheet. Satyam tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/CSS/Javascript question
JF on March 11th answered it appropriately. Please take this topic off this group. Thanks. On 3/12/06, Satyam [EMAIL PROTECTED] wrote: - Original Message - From: tedd [EMAIL PROTECTED] Hi all, Is it possible to modify a table using JavaScript to control CSS visabilty when the entire table is developed dynamically using PHP? Thanks, Paul Satyam said: You don't need to change the CSS (I don't even know if it is possible), but you can change specific styles of any element within the HTML. For example: Yes, it's just a text file -- it can be re-written. However, it needs to be loaded again to take affect. And it affects all documents of all users. Suddenly, by the action of one user, all other users reaching the same page will see things as per the actions of another user. Unless you take care to keep separate CSS files. document.getElementById('IdOfDivContainingTable').style.display='none'; It is particularly usefull to enclose whichever set of elements that you wish to change into a single entity, a DIV or SPAN, if at all possible. That's the main principle of ajax, isn't it? Using DOM to apply changes within the document. It might be old-hat to most, but I find it fascinating. No, this is not AJAX, it is simply using the DOM. Ajax also involves communication with the server in the background. Styles assigned in this way have precedence over those from a style sheet The precedence is simply inheritance -- last stated is applied. No, if you dynamically load a new stylesheet after you set the style of an element using the DOM, this style would still have precedence over the new stylesheet. The precedence of styles is set by how you set it. Setting a style through the DOM has precedence over CSS attributes, which have precedence over styles specified by the style HTML attribute which has precedence over the default rendering of an element. Only within the same category the order of assignment would matter. And, by the way, yes, you can load a new stylesheet. Satyam tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anas Mughal
Re: [PHP] PHP/CSS/Javascript question
Yes, it's just a text file -- it can be re-written. However, it needs to be loaded again to take affect. And it affects all documents of all users. Suddenly, by the action of one user, all other users reaching the same page will see things as per the actions of another user. Unless you take care to keep separate CSS files. Yes, that's true -- but I was thinking that the user was the coder and that's what he/she wanted to do -- not that it was open to users to change per their whim. Perhaps I misunderstood the original post. document.getElementById('IdOfDivContainingTable').style.display='none'; It is particularly usefull to enclose whichever set of elements that you wish to change into a single entity, a DIV or SPAN, if at all possible. That's the main principle of ajax, isn't it? Using DOM to apply changes within the document. It might be old-hat to most, but I find it fascinating. No, this is not AJAX, it is simply using the DOM. Ajax also involves communication with the server in the background. Yes, you are correct -- thanks for the clarification. At this point in my learning, both appear so intertwined that they are synonymous. Styles assigned in this way have precedence over those from a style sheet The precedence is simply inheritance -- last stated is applied. No, if you dynamically load a new stylesheet after you set the style of an element using the DOM, this style would still have precedence over the new stylesheet. The precedence of styles is set by how you set it. Setting a style through the DOM has precedence over CSS attributes, which have precedence over styles specified by the style HTML attribute which has precedence over the default rendering of an element. Only within the same category the order of assignment would matter. And, by the way, yes, you can load a new stylesheet. As Johnny Carson said often I didn't know that! -- thanks. So it's: DOM CSS HTML Browser Default -- is that the precedence you are saying? tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/CSS/Javascript question
- Original Message - From: tedd [EMAIL PROTECTED] Yes, it's just a text file -- it can be re-written. However, it needs to be loaded again to take affect. And it affects all documents of all users. Suddenly, by the action of one user, all other users reaching the same page will see things as per the actions of another user. Unless you take care to keep separate CSS files. Yes, that's true -- but I was thinking that the user was the coder and that's what he/she wanted to do -- not that it was open to users to change per their whim. Perhaps I misunderstood the original post. Well, the original question was quite short. Either of us might be right or wrong. I assumed the case of a table with optional sub-items, like an expanding tree, or a menu or a table with categories where you want to expand any of the categories into its components. document.getElementById('IdOfDivContainingTable').style.display='none'; It is particularly usefull to enclose whichever set of elements that you wish to change into a single entity, a DIV or SPAN, if at all possible. That's the main principle of ajax, isn't it? Using DOM to apply changes within the document. It might be old-hat to most, but I find it fascinating. No, this is not AJAX, it is simply using the DOM. Ajax also involves communication with the server in the background. Yes, you are correct -- thanks for the clarification. At this point in my learning, both appear so intertwined that they are synonymous. Styles assigned in this way have precedence over those from a style sheet The precedence is simply inheritance -- last stated is applied. No, if you dynamically load a new stylesheet after you set the style of an element using the DOM, this style would still have precedence over the new stylesheet. The precedence of styles is set by how you set it. Setting a style through the DOM has precedence over CSS attributes, which have precedence over styles specified by the style HTML attribute which has precedence over the default rendering of an element. Only within the same category the order of assignment would matter. And, by the way, yes, you can load a new stylesheet. As Johnny Carson said often I didn't know that! -- thanks. So it's: DOM CSS HTML Browser Default -- is that the precedence you are saying? That's what my manual says. I remembered there was some precedence issue from some code of mine, some time ago, that didn't work as expected. I think it was a style= attribute that wasn't working while when assigning it via the DOM did, and I couldn't figure out until I realized that a CSS definition was in between, having higher precedence than the style attribute, but lower than the DOM. One of those bugs that drive you nuts. Satyam tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/CSS/Javascript question
On 3/11/06, Paul Goepfert [EMAIL PROTECTED] wrote: Hi all, Is it possible to modify a table using JavaScript to control CSS visabilty when the entire table is developed dynamically using PHP? http://www.google.es/search?q=javascript+change+visibilitystart=0ie=utf-8oe=utf-8client=firefoxrls=org.mozilla:en-US:unofficial It shows some good examples. Look the firsts results. I think PHP has nothing to do here, it just writes the table to html, but if you do a good JS function and your PHP'd html has id's, it should work fine. Thanks, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Esú - http://esu.proyectoanonimo.com http://www.proyectoanonimo.com
Re: [PHP] PHP generated JavaScript
On Mon, February 20, 2006 1:59 am, Tim Burgan wrote: Is is possible to make an external Javascript with PHP. Am I doing this correcT? ?php header(Content-Type: text/javascript); $text = Hello World; echo alert('.$text.');; You may need to include the trailing newline on this line... I certainly would, needed or not. ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP generated JavaScript
On Mon, Feb 20, 2006 at 06:29:12PM +1030, Tim Burgan wrote: Is is possible to make an external Javascript with PHP. Am I doing this correcT? ?php header(Content-Type: text/javascript); $text = Hello World; echo alert('.$text.');; ? This looks perfectly fine. There are a few things you have to be careful with: - php strings can handle line endings, consider if you have: $text = Hello\nWorld; echo alert('. $text .'); You will end up with a javscript error. - A typical javascript file that resides on on a webserver will only be requested once from the webserver (pending cache settings) so resources for a page load will be minimal. If you have a php script output javascript, the browser will request the file on each request. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
On Mon, April 11, 2005 5:04 pm, Marek Kilimajer said: Richard Lynch wrote: On Mon, April 11, 2005 4:23 pm, Jared Williams said: Hmm, document.forms['Selection'].elements['distID[]'][0].value is perfectly valid, and should work in any decent browser. There is also document.getElementsByName() Didja try it? Cuz every time *I* ever tried it (back in Browser Wars 3.0/4.0 days, mind you) the JavaScript would see the [] as an array reference and *NOT* as part of the name. That was a long time ago. Try it now. No. My clients are starving musicians who get their computers out of the dumpsters after yours throw them away :-) They're stuck with version 3/4 browsers by hardware limitations. Maybe some day I'll even use CSS... Nah. Too flaky even now. I'll probably be dead before they get that mess cleaned up. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php and javascript
-Original Message- From: Richard Lynch To: Marek Kilimajer On Sun, April 10, 2005 4:32 pm, Marek Kilimajer said: Assuming your form is named Selection, you will have a javascript array document.forms['Selection'].elements['distID[]'] available. You can try: alert(document.forms['Selection'].elements['distID[]'][0].value); I can GUARANTEE this will *NOT* work. You *CANNOT* use [] as part of a 'name' in JavaScript. That's completely untrue -- I've done it many times with complete success. The above can even be written more concisely as alert(document['Selection']['distID[]'][0].value); Cheers! Mike To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
On Sun, April 10, 2005 4:32 pm, Marek Kilimajer said: Assuming your form is named Selection, you will have a javascript array document.forms['Selection'].elements['distID[]'] available. You can try: alert(document.forms['Selection'].elements['distID[]'][0].value); I can GUARANTEE this will *NOT* work. You *CANNOT* use [] as part of a 'name' in JavaScript. No way, no how. No matter how you quote it, embed it in a string, or try to sneak up on it. It ain't gonna work. 'Cuz I tried every godamn reasonable (and quite a few UN-resaonable) ways to do that. * You'll just have to know that elements[7] is the one that you want. Or maybe use an ID=xxx attribute that does NOT have [] in it. But that new-fangled ID attiribute was added long after I worried about this issue, so you're on your own for that. * In retrospect, you could probably write some kind of JavaScript function that iterates through every single element, and compares its '.name' to 'distID' and to '3' (assuming you use distID[3] for a name) and then return the one object you were looking for... But that would be horribly inefficient JavaScript and would make your page dog-slow, so don't do that. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php and javascript
On Sun, April 10, 2005 4:32 pm, Marek Kilimajer said: Assuming your form is named Selection, you will have a javascript array document.forms['Selection'].elements['distID[]'] available. You can try: alert(document.forms['Selection'].elements['distID[]'][0].value); I can GUARANTEE this will *NOT* work. You *CANNOT* use [] as part of a 'name' in JavaScript. No way, no how. No matter how you quote it, embed it in a string, or try to sneak up on it. It ain't gonna work. 'Cuz I tried every godamn reasonable (and quite a few UN-resaonable) ways to do that. * Hmm, document.forms['Selection'].elements['distID[]'][0].value is perfectly valid, and should work in any decent browser. There is also document.getElementsByName() Jared -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php and javascript
On Mon, April 11, 2005 4:23 pm, Jared Williams said: Hmm, document.forms['Selection'].elements['distID[]'][0].value is perfectly valid, and should work in any decent browser. There is also document.getElementsByName() Didja try it? Cuz every time *I* ever tried it (back in Browser Wars 3.0/4.0 days, mind you) the JavaScript would see the [] as an array reference and *NOT* as part of the name. Didn't matter what I did to try to convince it otherwise. YMMV -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
Richard Lynch wrote: On Mon, April 11, 2005 4:23 pm, Jared Williams said: Hmm, document.forms['Selection'].elements['distID[]'][0].value is perfectly valid, and should work in any decent browser. There is also document.getElementsByName() Didja try it? Cuz every time *I* ever tried it (back in Browser Wars 3.0/4.0 days, mind you) the JavaScript would see the [] as an array reference and *NOT* as part of the name. That was a long time ago. Try it now. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
PartyPosters wrote: Hello, I have a form that when I hit sumbit I want to test the varialble in javascript. I can get it working using test variables in php but I want to be able to call the input box in my form, the only problem is the name of the box is in an array (i think) as it's in a list. You can see the 2 samples of the code below which will hopefully make more sence. Can anyone help me out? Thanks. head SCRIPT language=JavaScript function checkdata() { alert(document.Selection.quantity[0].value) alert(TEST) return true } /SCRIPT /head --- while ($row=mysql_fetch_array($mysql_result)) { echo TR INPUT NAME = \distID[]\ TYPE = \HIDDEN\ VALUE=\$distID\ /TR; } Assuming your form is named Selection, you will have a javascript array document.forms['Selection'].elements['distID[]'] available. You can try: alert(document.forms['Selection'].elements['distID[]'][0].value); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP, over javascript code simple \n
* Thus wrote Louie Miranda: Im having problems. Because my javascript is inside a PHP code. Now below are 1 line code of a print function that display this on the html header. i must put \n after the Firstname. But PHP actually reads \n so when i view it on a browser the js code moves down. Which is wrong, because it wont work anymore.. what i want is js should use the \n instead. is there any alternative for \n? so it can display properly on php? ?php print( if (document.rpcjs_louie.ColCustName.value == \\) { walangfield += \Missing: Firstname\n\; } ); ? I'd only print() javascript only if absolutely necessary. otherwise simply break out of php: ?php // php code ? if (document.rpcjs_louie.ColCustName.value == ) { walangfield += Missing: Firstname\n; } ?php ? Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
Try radio buttons. You can't have lots of checkboxes like that. Or try one of those lists that you can select multiple parts. I don't remember what they're called. On Fri, 2003-03-21 at 10:25, shaun wrote: Hi, I'm not sure if this is a PHP or a JavaScript question but I have found the following code to enable me to select all of the checkboxes on my form. SCRIPT LANGUAGE=JavaScript !-- Begin var checkflag = false; function check(field) { if (checkflag == false) { for (i = 0; i field.length; i++) { field[i].checked = true;} checkflag = true; return Uncheck all; } else { for (i = 0; i field.length; i++) { field[i].checked = false; } checkflag = false; return Check all; } } // End -- /script form name=mon_formulaire action= method=post table bWhere do you connect to the Internet from?/bbr input type=checkbox name=list value=1Homebr input type=checkbox name=list value=2Officebr input type=checkbox name=list value=3Friends' homebr input type=checkbox name=list value=4Post officebr input type=checkbox name=list value=5Internet Cafbr br input type=button value=Check all onClick=this.value=check(this.form.list) /form The problem is that in the example all of the boxes are called list and i need to name each checkbox on my form with a different user_id so that i can collect the data sent from the form, is there a way around this? Thanks in advance for any advice offered. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
Put square brackets after the name of your checkboxes. input type=checkbox name=list[] value=1Homebr input type=checkbox name=list[] value=2Officebr etc Then you will be able to access all the boxes checked on your post page in an array $_POST['list'] shaun wrote: Hi, I'm not sure if this is a PHP or a JavaScript question but I have found the following code to enable me to select all of the checkboxes on my form. SCRIPT LANGUAGE=JavaScript !-- Begin var checkflag = false; function check(field) { if (checkflag == false) { for (i = 0; i field.length; i++) { field[i].checked = true;} checkflag = true; return Uncheck all; } else { for (i = 0; i field.length; i++) { field[i].checked = false; } checkflag = false; return Check all; } } // End -- /script form name=mon_formulaire action= method=post table bWhere do you connect to the Internet from?/bbr input type=checkbox name=list value=1Homebr input type=checkbox name=list value=2Officebr input type=checkbox name=list value=3Friends' homebr input type=checkbox name=list value=4Post officebr input type=checkbox name=list value=5Internet Cafébr br input type=button value=Check all onClick=this.value=check(this.form.list) /form The problem is that in the example all of the boxes are called list and i need to name each checkbox on my form with a different user_id so that i can collect the data sent from the form, is there a way around this? Thanks in advance for any advice offered. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
For what code to work, the JavaScript? In php, the only way you'll be able to get all the checkboxes that have been checked is to put the square brackets behind the name. For it to work in JavaScript, you have to reference the element such as document.forms[0].elements['list[]'][i].checked or something along those linesmy JS is a bit rusty. Shaun Thornburgh wrote: John, Thanks for your reply, but for the code to work the checkbox has to be called 'list' Shaun Thornburgh BSc Hons. Assertia Ltd - Web : http://www.assertia.net Email : [EMAIL PROTECTED] Office : 0845 123 2992 Mobile : 07976 711363 -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: 21 March 2003 20:04 To: shaun Cc: [EMAIL PROTECTED] Subject: Re: [PHP] php and javascript Put square brackets after the name of your checkboxes. input type=checkbox name=list[] value=1Homebr input type=checkbox name=list[] value=2Officebr etc Then you will be able to access all the boxes checked on your post page in an array $_POST['list'] shaun wrote: Hi, I'm not sure if this is a PHP or a JavaScript question but I have found the following code to enable me to select all of the checkboxes on my form. SCRIPT LANGUAGE=JavaScript !-- Begin var checkflag = false; function check(field) { if (checkflag == false) { for (i = 0; i field.length; i++) { field[i].checked = true;} checkflag = true; return Uncheck all; } else { for (i = 0; i field.length; i++) { field[i].checked = false; } checkflag = false; return Check all; } } // End -- /script form name=mon_formulaire action= method=post table bWhere do you connect to the Internet from?/bbr input type=checkbox name=list value=1Homebr input type=checkbox name=list value=2Officebr input type=checkbox name=list value=3Friends' homebr input type=checkbox name=list value=4Post officebr input type=checkbox name=list value=5Internet Cafébr br input type=button value=Check all onClick=this.value=check(this.form.list) /form The problem is that in the example all of the boxes are called list and i need to name each checkbox on my form with a different user_id so that i can collect the data sent from the form, is there a way around this? Thanks in advance for any advice offered. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
thank you so much... I got the function working On Tue, 2003-03-18 at 17:52, Jim Lucas wrote: you are trying to include a variable inside a single quoted string. change the echo line to this. echo script language='javascript' window.location = '$thepage' /script; Jim - Original Message - From: Antoine [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 2: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 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Antoine [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
you are trying to include a variable inside a single quoted string. change the echo line to this. echo script language='javascript' window.location = '$thepage' /script; Jim - Original Message - From: Antoine [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 2: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 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
It has to do with the fact that you're using single quotes, and $thepage is not replaced for its value. I think you'd want to rewrite the function like this (note the \ escaping the ): function js_pointer_login($thepage) { echo script language=\javascript\ window.location = '$thepage' /script; } Hope this Helps, Oscar F. Antoine wrote: 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'; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
- Original Message - From: Antoine [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
At 23:52 18-3-2003, you wrote: 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'; } beside the quote thing which others mentioned, please make it as cross-browser-compatible as possible: window.location.href= and try to let $thepage be a complete url, including the http:// and the www.domain.org/ part. That will work in more browsers! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
On Tue, 18 Mar 2003 15:59:32 -0700, Kevin Stone wrote about Re: [PHP] php and javascript what the universal translator turned into this: - Original Message - From: Antoine [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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=; parent.location.href= works just as fine ... and it's also portable directly to frames sub-files. Oh, and in JavaScript the end-line ; markers aren't used ... they're ignored mostly, but some older browsers caugh and spit at them ... JS standard doesn't require them, but because they're used in Java and JScript, the newer JIT compilers just ignore them... Rene -- Rene Brehmer This message was written on 100% recycled spam. Come see! My brand new site is now online! http://www.metalbunny.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and JavaScript
After--that's client-side stuff. Marco -- php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmer Come visit us at http://www.phparch.com! ---BeginMessage--- On a PHP event, does the onLoad event in a document run before or after the page is parsed, created, and sent to the user? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and JavaScript
At 17:24 07.11.2002, John Meyer spoke out and said: [snip] On a PHP event, does the onLoad event in a document run before or after the page is parsed, created, and sent to the user? [snip] Hmm - maybe I should a little elaborate on this topic, as it is very often misunderstood. Statement 1: PHP runs at the server side, and Java/VB/Whateverscript at the client's. Statement 2: First, all server side applications are processed, generating output. Second, the client parses data received from the server and displays it. --- If you lean back and look at these two statements, it will be very clear that the client doesn't know anything how data was constructed by the server, and the server doesn't know what the client will do with the data it is about to transmit. The server builds the HTML code, including any JavaScript functions and event handlers. These are just ordinary text to the server application; it does nothing special with it. The client (if JavaScript is enabled) will execute the onLoad() code as soon as the _whole_page_ has been received AND rendered, at this time the server has already forgotten about the request... There cannot (CANNOT) be any interaction between client-side Javascript and any server-side application. These two are effectively independent! Hope this clears things up... -- O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/
Re: [PHP] PHP and JavaScript
onLoad is Javascript, and thus AFTER page was parsed. -- Maxim Maletsky [EMAIL PROTECTED] John Meyer [EMAIL PROTECTED] wrote... : On a PHP event, does the onLoad event in a document run before or after the page is parsed, created, and sent to the user? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and JavaScript on a validation NIGHTMARE
Use globals variables instead hidden fields. Maybe it works. Peace Love skitum - Original Message - From: Riccardo Sepe [EMAIL PROTECTED] To: php-general [EMAIL PROTECTED] Sent: Tuesday, October 01, 2002 1:34 PM Subject: [PHP] PHP and JavaScript on a validation NIGHTMARE Hi every1 I'm stucked with this page in which I would like to perform some check before submit and in the meantime I need to be able to change some content upon a choice at the top of the page. My first attempt was: The form has been submitted every time I change the option at the top of the page ... PHP decides the content of the page.. Javascript performs the checks and then submit the form. PHP has to recognise the status (I mean checked performed do the real task) so I used an isset statement. The problem using isset is that PHP doesn't find the variable after Javascript has performed its check If I use a hidden field then PHP doesn't understand when I'm asking to change the content or actually sending the form for the real task. After this I said Javascript could manage the dinamically changing of the content but I found out that Layer feature is not supported with mozilla . Any clue ?? thanks a lot guys ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and JavaScript on a validation NIGHTMARE
skitum wrote: Use globals variables instead hidden fields. Maybe it works. Peace Love skitum Cool mate I' ll let u know! bye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and JavaScript on a form validation task
Instead of check for $ready2be_checked, use a hidden form field instead of relying on the submit button to be pressed. If the Javascript auto-submits the form the hidden field will still be there. -Kevin - Original Message - From: Riccardo Sepe [EMAIL PROTECTED] To: php-general [EMAIL PROTECTED] Sent: Friday, September 27, 2002 2:19 PM Subject: [PHP] PHP and JavaScript on a form validation task Hi every1 I'm buidin' up a form that should perform a couple of checks before submit. I used javascript but as the form has got option fields also and some field changes upon the checkbox chosen the script has to know when I'm just changing the option or when I'm tryin' 2 send the form... (in order to change the option or eventually perform the check). Can I do that on the same page? ..I mean can I pass a variable through javascript 2 php? The problem is that if I call the submit button ready2be_checked and I use an onclick(validate_the_form) handle, javascript works fine but it misses the variable ready2be_checked so the isset statement for ex. if(isset($ready2be_checked)){ } doesn't work! Using onsubmit instead, javascript performs the check and sends the form anyway cause the isset check finds the variable $ready2be_checked !! ? ? ? ? ? ? ? Sorry if I posted it twice Thanx in advance Ricky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript question
As far as I'm aware you can't create a javascript variable and use it within PHP on the same page. You can add that variable's value to a hidden form element to be passed to the next page, but I don't think so with the same page. martin kemu [EMAIL PROTECTED] 06/05/02 02:30PM I have a page first he generates a var in javascript my next question is is it possible to use that var in php on the same page first he does the javascript then the php ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php and javascript question
As someone else suggested a few days ago: try using an IFRAME, and refreshing it from javascript with the values you need. The whole browser will not refresh, just the IFRAME, which will give the illusion of jscript and php talking to each other in realtime. --- Scott Hurring Systems Programmer EAC Corporation [EMAIL PROTECTED] Voice: 201-462-2149 Fax: 201-288-1515 -Original Message- From: Martin Clifford [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 05, 2002 4:24 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] php and javascript question As far as I'm aware you can't create a javascript variable and use it within PHP on the same page. You can add that variable's value to a hidden form element to be passed to the next page, but I don't think so with the same page. martin kemu [EMAIL PROTECTED] 06/05/02 02:30PM I have a page first he generates a var in javascript my next question is is it possible to use that var in php on the same page first he does the javascript then the php ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript question
On Wed, 5 Jun 2002, Martin Clifford wrote: As far as I'm aware you can't create a javascript variable and use it within PHP on the same page. You can add that variable's value to a hidden form element to be passed to the next page, but I don't think so with the same page. You're quite right; the PHP executes and terminates before the JavaScript ever starts. If you want to get JavaScript-calculated values back into PHP, you have to pass them back through new requests to the server. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and JavaScript
It worked for me, what error are you getting? In the other.html, did you have this? html head title/title script language=JavaScript src=script.php/script /head body /body /html -Original Message- From: mp [mailto:[EMAIL PROTECTED]] Sent: May 26, 2002 3:05 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP and JavaScript Hi, php-general, I make this kind of PHP script(script.php): script.php ? $variable = Some some long long Text Blah blah; echo document.write(\.$variable.\); ? And in HTML (other.html) file I write: script language=JavaScript src=script.php/script But there is some mistake. Does anybody can help me? Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and JavaScript
On Sun, 26 May 2002 10:05:03 +0300, mp wrote: Hi, php-general, I make this kind of PHP script(script.php): script.php ? $variable = Some some long long Text Blah blah; echo document.write(\.$variable.\); ? And in HTML (other.html) file I write: script language=JavaScript src=script.php/script But there is some mistake. Does anybody can help me? Thanks... make sure $variable doesn't have any newlines. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
Your popup window should be an normal PHP page calling your images in the database. You can then setup your form to call the popup windows via javascript using the window.open() method. /dkm - Original Message - From: Scott [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 25, 2002 6:13 PM Subject: [PHP] php and javascript I have some image urls that I have stored in a mysql database. I want to be able to display the images in a popup window using javascript. But I haven't been able to figure out how to get the get the info to mysql so that the image loads when the popup window appears. Below is an example of the form without any javascript. form action=test.php method=post INPUT type=submit value=See Photo name=button INPUT type=hidden name=item_no value=?php echo $item_no; ? /formbrbr Any help appreciated. Thanks, SW -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript
Hello Karl, Publish your code, plz. We are not wizards. :) 27 July, 2001, 14:08:05, you wrote: KP Does anyone know how to pass php variables to a javascript for processing. KP I have a DHTML menu system that requires variables be attached to the url KP contained within it. Using echo does not print the variable to the url. KP Is there another way? -- Best regards, Vitalimailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php and javascript
Hello Karl, Friday, July 27, 2001, 1:08:05 PM, you wrote: KP Does anyone know how to pass php variables to a javascript for processing. KP I have a DHTML menu system that requires variables be attached to the url KP contained within it. Using echo does not print the variable to the url. KP Is there another way? KP Thx in advance. script language=javascript varname='? echo $varname; ?'; some usage of varname; /script I had a same problem some time ago. There must be a single quotes neither is it string nor any other type. I hope it helps -- Best regards, Danielmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php and javascript
I am not sure exactly what you are doing, but the thing to remember is that your PHP script is writing your HTML and JavaScript. As long as you keep that in mind it is fairly easy to see how to pass variables to JS. Here is a very simple example ?php $foo = bar; ? HTML Body Script language=Javascript var foo = ?php echo $foo; ?; document.writeln(foo); /Script /Body /HTML If you need something more specific post some code. Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com - Original Message - From: Karl Phillipson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, July 27, 2001 6:08 AM Subject: [PHP] php and javascript Does anyone know how to pass php variables to a javascript for processing. I have a DHTML menu system that requires variables be attached to the url contained within it. Using echo does not print the variable to the url. Is there another way? Thx in advance. Karl == Karl Phillipson PHP SQL Programmer Saffron Hill Ventures 67 Clerkenwell Road London EC1R 5BL == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php and javascript
On Friday 02 March 2001 06:21, you wrote: Hello, Are there any good examples of producing embedded javascript code in a php file? ?php somecode ? script language='javascript' sglfjh s /script ?php more code ? -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence. - Edsger W. Dijkstra -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] php and javascript
Well not sure what ya need an example of :) php is php and javascript is javascript. What excatly do you need help wiht ? -Original Message- From: Christian Reiniger [mailto:[EMAIL PROTECTED]] Sent: March 2, 2001 5:34 AM To: Php-General@Lists. Php. Net Subject: Re: [PHP] php and javascript On Friday 02 March 2001 06:21, you wrote: Hello, Are there any good examples of producing embedded javascript code in a php file? ?php somecode ? script language='javascript' sglfjh s /script ?php more code ? -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence. - Edsger W. Dijkstra -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php and javascript
From: "Carl Natale" [EMAIL PROTECTED] I need some help passing a variable to a popup window. The following form collects input from the user and stores it in the variable $summary. ? print "FORM action=\"hint.php\" METHOD=\"post\""; $summary = "Hellow universe"; print "INPUT TYPE=\"hidden\" name=\"summary\" value=\"$summary\" "; print "input type=\"submit\" value=\"Try This\" onClick=\"window.open('hint.php', 'remote', 'menubar,scrollbars,resizable,width=350,height=200,left=20,top=20'); return false;\""; print "/form"; ? Try: window.open('hint.php?summary=" . urlencode($summary) . "', ) Realise that the pop-up window is a totally separate document, from the web server's point of view, hence hint.php cannot magically get the value of $summary from the form page. When you click on the "Try This" button, hint.php opens up in another, smaller window just like I wanted. But the variable $summary doesn't show up ? file://hint.php script says this file://THIS LINE PRINTS print "Here's the hint:BR"; file://BUT NOT THIS ONE print $summary; ? If I take JavaScript out of the submit coding, the browser window moves to hint.php and prints the $summary variable. I'm much more comfortable with PHP than JavaScript. How can I deliver the text in $summary to a second, smaller window? Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php and javascript
try ? print "FORM action=\"hint.phtml\" METHOD=\"post\""; $summary = "Hellow universe"; print "INPUT TYPE=\"hidden\" name=\"summary\" value=\"$summary\" "; print "input type=\"submit\" value=\"Try This\" onClick=\"window.open('hint.phtml?summary=$summary', 'remote', 'menubar,scrollbars,resizable,width=350,height=200,left=20,top=20'); return false;\""; print "/form"; ? hope that helps best regards Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India - Original Message - From: "Carl Natale" [EMAIL PROTECTED] To: "Php" [EMAIL PROTECTED] Sent: Wednesday, February 21, 2001 7:41 AM Subject: [PHP] php and javascript I need some help passing a variable to a popup window. The following form collects input from the user and stores it in the variable $summary. ? print "FORM action=\"hint.php\" METHOD=\"post\""; $summary = "Hellow universe"; print "INPUT TYPE=\"hidden\" name=\"summary\" value=\"$summary\" "; print "input type=\"submit\" value=\"Try This\" onClick=\"window.open('hint.php', 'remote', 'menubar,scrollbars,resizable,width=350,height=200,left=20,top=20'); return false;\""; print "/form"; ? When you click on the "Try This" button, hint.php opens up in another, smaller window just like I wanted. But the variable $summary doesn't show up ? file://hint.php script says this file://THIS LINE PRINTS print "Here's the hint:BR"; file://BUT NOT THIS ONE print $summary; ? If I take JavaScript out of the submit coding, the browser window moves to hint.php and prints the $summary variable. I'm much more comfortable with PHP than JavaScript. How can I deliver the text in $summary to a second, smaller window? Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]