[PHP] PHP/Javascript Job in Madrid
Hi all, I am Bárbara Vilela and I work at Tuenti in the Human Resources department in Madrid. Tuenti is a social application and our mission is to improve the communication and transmission of information between people who know each other. Already the #6 most-trafficked website in Spain, Tuenti is also one of the fastest-growing Alexa Top 500 sites and one of the largest invite-only websites worldwide. I am writing you because we have job opportunities for PHP/JavaScript Engineers that could be interesting for you. You can find more information about this position here: http://tbe.taleo.net/NA11/ats/careers/requisition.jsp?org=TUENTITECHNOLOGIEScws=1rid=25 If you think you fit for this job please send me an e-mail with your CV and I´ll get in contact with you soon. Thank you very much, Bárbara Vilela Fernandes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Javascript header
Hello there, Kind of newbie to PHP and javascript... I have this problem: I want to pass a javascript variable to a PHP code. I am inside a javascript function that is creating HTML elements dynamically. After creating a select tag, I want to populate it with a list of variable names from $_SESSION['subgroupcolumn'] . Here is part of the code: . . . location.href=subgroup.php?m= + m; var linner= for ($c=1; $c $_SESSION['rows']; $c++){ echo( 'option value=' . $c . '' . $_SESSION['subgroupcolumn'][$c][0] . '/option\n' ); } ; document.getElementById(selectedSubsetText + hitcounter).innerHTML = linner ; . . . Since we cannot pass a javascript var to PHP directly, I am redirecting to subgroup.php and sending the variable (m) and getting it there using a $_GET. Now the question: In subgroup.php, after I get the variable m, I create the $_SESSION['subgroupcolumn'] array then I redirect to the initial page. Obviously it's not working because the code after location.href=subgroup.php?m= + m; is not executing after coming back to the initial page How do I make it to continue executing the javascript code? I hope it's clear... Thanks for your help. -- View this message in context: http://www.nabble.com/PHP-Javascript-header-tp21483721p21483721.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 Javascript header
Applejus wrote: Hello there, Kind of newbie to PHP and javascript... I have this problem: I want to pass a javascript variable to a PHP code. I am inside a javascript function that is creating HTML elements dynamically. After creating a select tag, I want to populate it with a list of variable names from $_SESSION['subgroupcolumn'] . Here is part of the code: . . . location.href=subgroup.php?m= + m; var linner= for ($c=1; $c $_SESSION['rows']; $c++){ echo( 'option value=' . $c . '' . $_SESSION['subgroupcolumn'][$c][0] . '/option\n' ); } ; document.getElementById(selectedSubsetText + hitcounter).innerHTML = linner ; . . . Since we cannot pass a javascript var to PHP directly, I am redirecting to subgroup.php and sending the variable (m) and getting it there using a $_GET. Now the question: In subgroup.php, after I get the variable m, I create the $_SESSION['subgroupcolumn'] array then I redirect to the initial page. Obviously it's not working because the code after location.href=subgroup.php?m= + m; is not executing after coming back to the initial page How do I make it to continue executing the javascript code? I hope it's clear... Thanks for your help. The problem is that you are changing the location of the page and then chaning the location back. Really you need an AJAX call using XMLHttpRequest. There are probably easier examples, but here is one: http://www.w3schools.com/PHP/php_ajax_suggest.asp -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php javascript interaction
William Stokes wrote: Hello, I need some advice on how to learn Javascript and PHP interaction. Any good tutorials on the web would be most welcome. I particulary need to learn how to pass JS user input/choices to PHP. My current problem is how to ask user confirmation over his actions on a web form after POST. Are you sure type questions and how to pass the user choice back to program make choices with PHP. http://php.net/json http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html ^^-- note the name! toys.lerdorf.com is a veritable goldmine of funky info, lots of php magic to be had there. Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php javascript interaction
Hello, I need some advice on how to learn Javascript and PHP interaction. Any good tutorials on the web would be most welcome. I particulary need to learn how to pass JS user input/choices to PHP. My current problem is how to ask user confirmation over his actions on a web form after POST. Are you sure type questions and how to pass the user choice back to program make choices with PHP. Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php javascript interaction
William Stokes wrote: Hello, I need some advice on how to learn Javascript and PHP interaction. Any good tutorials on the web would be most welcome. I particulary need to learn how to pass JS user input/choices to PHP. My current problem is how to ask user confirmation over his actions on a web form after POST. Are you sure type questions and how to pass the user choice back to program make choices with PHP. Thanks -Will For the second question try google with something like javascript form submit. For the first question, see: http://ca.php.net/manual/en/language.variables.predefined.php Form data is captured in PHP in a number of different predefined variables accessible from your scripts. This page defines these varibables. -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php javascript interaction
Myron Turner skrev: William Stokes wrote: Hello, I need some advice on how to learn Javascript and PHP interaction. Any good tutorials on the web would be most welcome. I particulary need to learn how to pass JS user input/choices to PHP. My current problem is how to ask user confirmation over his actions on a web form after POST. Are you sure type questions and how to pass the user choice back to program make choices with PHP. Thanks -Will For the second question try google with something like javascript form submit. For the first question, see: http://ca.php.net/manual/en/language.variables.predefined.php Form data is captured in PHP in a number of different predefined variables accessible from your scripts. This page defines these varibables. Use AJAX Link: http://javascript.internet.com/ajax/ajax-navigation.html is migth be what you are looking for: http://javascript.internet.com/ajax/check-username-signup.html The cool thing with AJAX is that it can load pages while viewing the webpage. Without updating it! check out this chat i made with it: http://wsd.riddergarn.dk/index.php?p=chat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP, Javascript, and Forms
Hi, I have a form with about 20 fields in it and have two drop down menus in which the second one changes depending on the previous one. This is done with a javascript which reloads the page. The problem with this is that everything the user has put in so far gets erased when the page reloads. I am using PHP sessions, but at this point these fields are not saved yet. Is there a way to do this using sessions, or some other PHP function. All the javascript I've looked at reloads the page. This also screws up my validation routines. Thanks B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP, Javascript, and Forms
I think a better way for you to go(it may be a little bit more difficult, but it won't have any annoying flickering from the reloading of page) is to use AJAX. But if you insist on going on a PHP form + Javascript validation - submit form -PHP form + Javascript validation, that can be done as well. It might help to put up a sniplet of your PHP code. When you say the page is reloading, I assume that you mean you have a form tag that sends the POST data back to itself? Beauford wrote: Hi, I have a form with about 20 fields in it and have two drop down menus in which the second one changes depending on the previous one. This is done with a javascript which reloads the page. The problem with this is that everything the user has put in so far gets erased when the page reloads. I am using PHP sessions, but at this point these fields are not saved yet. Is there a way to do this using sessions, or some other PHP function. All the javascript I've looked at reloads the page. This also screws up my validation routines. Thanks B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP, Javascript, and Forms
Beauford wrote: Hi, I have a form with about 20 fields in it and have two drop down menus in which the second one changes depending on the previous one. This is done with a javascript which reloads the page. The problem with this is that everything the user has put in so far gets erased when the page reloads. I am using PHP sessions, but at this point these fields are not saved yet. Is there a way to do this using sessions, or some other PHP function. All the javascript I've looked at reloads the page. Javascript can do this easily, you set up your variable content section in a div. Then use div.innerHTML = newcontent. Only the content of the div will change. Searching for innerHTML should give you a few tutorials and full examples. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP, Javascript, and Forms
At 10:03 PM -0400 5/30/06, Beauford wrote: Hi, I have a form with about 20 fields in it and have two drop down menus in which the second one changes depending on the previous one. This is done with a javascript which reloads the page. The problem with this is that everything the user has put in so far gets erased when the page reloads. I am using PHP sessions, but at this point these fields are not saved yet. Is there a way to do this using sessions, or some other PHP function. All the javascript I've looked at reloads the page. This also screws up my validation routines. Thanks B B: Use ajax to populate the php session variables. 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
[PHP] PHP JavaScript
Can they play nicely together? For instance I have a small JavaScript sniplet that will check certain checkboxes if a radio button is selected. Since I have a fair amount of checkboxes I want to put them in an array all their own so I use the XHTML syntax w/brackets; input type=checkbox name=list37[] value=7 / Suddenly JavaScript doesn't care for the object and throws an error (take the brackets out and it works fine for JS, but PHP cannot see all of the values). I have Googled for this but think that my search term(s) are failing me because the condition is hard to describe. Would someone please point me in the right direction? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP JavaScript
Jay Blanchard wrote: Can they play nicely together? For instance I have a small JavaScript sniplet that will check certain checkboxes if a radio button is selected. Since I have a fair amount of checkboxes I want to put them in an array all their own so I use the XHTML syntax w/brackets; input type=checkbox name=list37[] value=7 / Suddenly JavaScript doesn't care for the object and throws an error (take the brackets out and it works fine for JS, but PHP cannot see all of the values). I have Googled for this but think that my search term(s) are failing me because the condition is hard to describe. Would someone please point me in the right direction? Thanks! I don't remember exactaly what I had to do, but I remember quoting it somehow made it work with JS. Something like... document.formname.elements['list37[]'] I *think*. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP JavaScript
-Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Friday, May 19, 2006 10:34 AM To: php-general@lists.php.net Subject: [PHP] PHP JavaScript input type=checkbox name=list37[] value=7 / Suddenly JavaScript doesn't care for the object and throws an error (take the brackets out and it works fine for JS, but PHP cannot see all of the values). I have Googled for this but think that my search term(s) are failing me because the condition is hard to describe. Would someone please point me in the right direction? I ran into this problem once too and had a terrible time finding an answer. I started finding some stuff with the following search terms: php checkbox array javascript entity reference Which brought up a page in the manual. It had two helpful notes: http://us2.php.net/variables.external kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP JavaScript
[snip] http://us2.php.net/variables.external [/snip] BINGO! We have a winner! It can be as simple as adding an id to each checkbox; input type=checkbox id=list37 name=list37[] value=4 / By doing this I did not have to change the function or the function calls. JS recognizes the boxes by id, PHP recognizes the array. There were some other more complex solutions listed.but I believe in KISS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP JavaScript
John Nichel wrote: Jay Blanchard wrote: Can they play nicely together? For instance I have a small JavaScript sniplet that will check certain checkboxes if a radio button is selected. Since I have a fair amount of checkboxes I want to put them in an array all their own so I use the XHTML syntax w/brackets; input type=checkbox name=list37[] value=7 / Suddenly JavaScript doesn't care for the object and throws an error (take the brackets out and it works fine for JS, but PHP cannot see all of the values). I have Googled for this but think that my search term(s) are failing me because the condition is hard to describe. Would someone please point me in the right direction? Thanks! I don't remember exactaly what I had to do, but I remember quoting it somehow made it work with JS. Something like... document.formname.elements['list37[]'] I *think*. I think you think right = pretty sure about that actually :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP JavaScript
Jay Blanchard wrote: [snip] http://us2.php.net/variables.external [/snip] BINGO! We have a winner! It can be as simple as adding an id to each checkbox; input type=checkbox id=list37 name=list37[] value=4 / By doing this I did not have to change the function or the function calls. JS recognizes the boxes by id, PHP recognizes the array. There were some other more complex solutions listed.but I believe in KISS Shouldn't ID's on xhtml tags be unique? Or is this special because of the array construction? Gr, Koen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP JavaScript
I think it's a case of using id for javascript, not for css... -- http://www.web-buddha.co.uk dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css) look out for project karma, our new venture, coming soon!
Re: [PHP] PHP JavaScript
Jay Blanchard wrote: [snip] http://us2.php.net/variables.external [/snip] BINGO! We have a winner! It can be as simple as adding an id to each checkbox; input type=checkbox id=list37 name=list37[] value=4 / By doing this I did not have to change the function or the function calls. JS recognizes the boxes by id, PHP recognizes the array. There were some other more complex solutions listed.but I believe in KISS Next time, RTFM! :-p -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP JavaScript
Dave Goodchild wrote: I think it's a case of using id for javascript, not for css... Call me a purist, but quoting http://www.w3.org/TR/xhtml1/ (and you can probably find likewise paragraphs in other xhtml specs, all stemming from the basic XML property that id's are unique): 4.10. The elements with 'id' and 'name' attributes HTML 4 defined the name attribute for the elements a, applet, form, frame, iframe, img, and map. HTML 4 also introduced the id attribute. Both of these attributes are designed to be used as fragment identifiers. In XML, fragment identifiers are of type ID, and there can only be a single attribute of type ID per element. Therefore, in XHTML 1.0 the id attribute is defined to be of type ID. In order to ensure that XHTML 1.0 documents are well-structured XML documents, XHTML 1.0 documents MUST use the id attribute when defining fragment identifiers on the elements listed above. See the HTML Compatibility Guidelines for information on ensuring such anchors are backward compatible when serving XHTML documents as media type text/html. Note that in XHTML 1.0, the name attribute of these elements is formally deprecated, and will be removed in a subsequent version of XHTML. So, using the same ID produces non-valid documents if you ask me. Best, Koen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP JavaScript
[snip] So, using the same ID produces non-valid documents if you ask me. [/snip] This is correct, and in order to properly validate I changed it to transitional instead of strict. This is an internal appif it were external I would do this differently for sure -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP JavaScript
I use document.getElementById().value. The only change that would need to be made with the input example is add an id=list['.$x.'] Jef -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Friday, May 19, 2006 8:47 AM To: php-general@lists.php.net Subject: Re: [PHP] PHP JavaScript Jay Blanchard wrote: Can they play nicely together? For instance I have a small JavaScript sniplet that will check certain checkboxes if a radio button is selected. Since I have a fair amount of checkboxes I want to put them in an array all their own so I use the XHTML syntax w/brackets; input type=checkbox name=list37[] value=7 / Suddenly JavaScript doesn't care for the object and throws an error (take the brackets out and it works fine for JS, but PHP cannot see all of the values). I have Googled for this but think that my search term(s) are failing me because the condition is hard to describe. Would someone please point me in the right direction? Thanks! I don't remember exactaly what I had to do, but I remember quoting it somehow made it work with JS. Something like... document.formname.elements['list37[]'] I *think*. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [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 JavaScript
Simplest solution is to use id=whatever for JS. It *is* possible to get [] into the name of a box in JS, but I never succeeded in any useful way myself. On Fri, May 19, 2006 9:33 am, Jay Blanchard wrote: Can they play nicely together? For instance I have a small JavaScript sniplet that will check certain checkboxes if a radio button is selected. Since I have a fair amount of checkboxes I want to put them in an array all their own so I use the XHTML syntax w/brackets; input type=checkbox name=list37[] value=7 / Suddenly JavaScript doesn't care for the object and throws an error (take the brackets out and it works fine for JS, but PHP cannot see all of the values). I have Googled for this but think that my search term(s) are failing me because the condition is hard to describe. Would someone please point me in the right direction? Thanks! -- 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 JavaScript
For grouped checkboxes that have numerical keys, why not give them an ID that's simply a concatenation of NAME and the VALUE, so it's unique? Run the NAME though a preg_replace to replace non alphanum chars (\W+) with an underscore first to make sure it's a valid ID. i.e. checkbox name=blah[] id=blah_1 value=1 checkbox name=blah[] id=blah_2 value=2 I've used this with some code i wrote that allows me to either output a multi-select or a group of checkboxes, from a single array of values. On 5/19/06, Richard Lynch [EMAIL PROTECTED] wrote: Simplest solution is to use id=whatever for JS. It *is* possible to get [] into the name of a box in JS, but I never succeeded in any useful way myself. On Fri, May 19, 2006 9:33 am, Jay Blanchard wrote: Can they play nicely together? For instance I have a small JavaScript sniplet that will check certain checkboxes if a radio button is selected. Since I have a fair amount of checkboxes I want to put them in an array all their own so I use the XHTML syntax w/brackets; input type=checkbox name=list37[] value=7 / Suddenly JavaScript doesn't care for the object and throws an error (take the brackets out and it works fine for JS, but PHP cannot see all of the values). I have Googled for this but think that my search term(s) are failing me because the condition is hard to describe. Would someone please point me in the right direction? Thanks! -- 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 -- Scott Hurring [scott dot hurring dot lists at gmail dot com] http://hurring.com/
RE: [PHP] PHP JavaScript
[snip] For grouped checkboxes that have numerical keys, why not give them an ID that's simply a concatenation of NAME and the VALUE, so it's unique? [/snip] Because JavaScript loops through all the like ID'ed checkboxes to check or uncheck groups. It could be done the other way, but then JavaScript code has to have more to it to increment from the value of the first ID. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP JavaScript
Yeah, i guess it all depends what you're doing what works for you. Another avenue to try (depending on your application) is: Group all your checkboxes together inside of a uniquely-named DIV and then use javascript to get all of the checkbox elements inside the DIV. That way, you dont really need to know or care about their id/name. On 5/19/06, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] For grouped checkboxes that have numerical keys, why not give them an ID that's simply a concatenation of NAME and the VALUE, so it's unique? [/snip] Because JavaScript loops through all the like ID'ed checkboxes to check or uncheck groups. It could be done the other way, but then JavaScript code has to have more to it to increment from the value of the first ID. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Scott Hurring [scott dot hurring dot lists at gmail dot com] http://hurring.com/
Re: [PHP] PHP JavaScript
On May 19, 2006, at 8:20 AM, Jay Blanchard wrote: [snip] http://us2.php.net/variables.external [/snip] BINGO! We have a winner! It can be as simple as adding an id to each checkbox; input type=checkbox id=list37 name=list37[] value=4 / By doing this I did not have to change the function or the function calls. JS recognizes the boxes by id, PHP recognizes the array. There were some other more complex solutions listed.but I believe in KISS I'm one of 'em, I do javascript programming myself and finding the right simplicity can be one hell of a task. I'll keep this in mind for the future. I'm thinking of starting a web site database for posting of any and all who are willing to contribute to a single source for all bugs, levels of javascript DOM and css support in all or as many as possible extant browsers. Quirks, you name it. It will be if you have knowledge and solutions and want to contribute. It won't be a gripe and hold my hand and listen to my woes, but look for a subject like a particular browser and version, OS, platform and get a knowledge base for that query. Here's one to start: Internet Explorer v5 on Mac OSX and others won't run a function with a variable declared inside the function. The variable has to be declared outside of the function in the global space before it will be used inside a function. This occurs with form submission from an onclick event, rather than a submit button. I do this to insure that input filters are run before the form is sent to the server. The functions I write for this do pre submit processing like run regex filters on text fields and text areas and use document.forms formname.submit(). In a particular class of browser, but not all versions of the same browser nor platform will run the function with variables declared inside the function. I don't think this is 'OT' for this list because for me php and javascript are great team mates. But javascript can be a rats nest particularly for dhtml. I have some demonstrations in my web site but I'm being timid about giving out the url until it has time to prove it will stay afloat before a crowd tries to use it. (I host my own site from an ADSL connection). I'm running php 5.0.1 with gd support, freetype, t1, mysql, etc, etc. on FreeBSD. JK. -- 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
[Fwd: Re: [PHP] PHP / JavaScript integration]
this post was meant for the OP - I sent it to Chris W. (only) by mistake. oops Original Message From: - Wed Mar 09 19:50:29 2005 Chris W. Parker wrote: Mário Gamito mailto:[EMAIL PROTECTED] on Tuesday, March 08, 2005 4:28 PM said: I'm trying to integrate some JavaScript functions in PHP, but so far, no good :( [snip] Now... i want to call this JavaScript function from the regular PHP files. In particular, before the HTML code. Like this: [snip] How can i do this ? How to tell PHP, that def(word) is a JS function in js.php file ? I've tried include ('js.php'), etc., but got no results :( include ('js.php') will output the contents of that file to the browser, assuming include() actually finds the file. You don't and you can't. PHP does not interact with the client (like you are thinking it does) and Javascript does not interact with the server. They are completely different and not related, except that PHP can send Javascript to the client for the client to interpret. javascript is a scripting language, there is no theoretical reason that it can't be used as a serverside scripting language, but the fact that practically nobody in the real does says something :-). anyway its not strictly correct to say javascript is 'clientside'. as for calling a javascript function directly from php code, forget about it. It's a bit confusing at first but once you understand it, you'll wonder why it ever didn't make sense. 1 round trip: 1. a (php) webserver gets a request for a page. 2. the server runs the requested (php) script. 3. the server sending some output to the browser. 4. the browser interprets the output. the output is generally a webpage - this can include script tags that contain/include javascript. when the page is parsed and rendered by the browser the javascript you included will be run. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP / JavaScript integration
Hi, I'm trying to integrate some JavaScript functions in PHP, but so far, no good :( I want to have a js.php file that has the JavaScript functions i want to use. This file, albeit its extension, has no PHP code or even tag. It's just like this: js.php -- script language=JavaScript function def(word) { if (word == 'all_not_filled') { type = 'error1'; definition = 'You didn't filled all form fields.'; } myFloater = window.open(filename,'myWindow','scrollbars=no,status=no,width=300,height=200') } /script -- Now... i want to call this JavaScript function from the regular PHP files. In particular, before the HTML code. Like this: index.php -- ?php if (condition) def('all_not_filled') // def is a JS function in js.php You can't do that. You could do this: ?php require 'def.js'; if (...) echo def('all_not_filled');; ? Then, when the page gets sent to the browser, the def() function gets called by the browser. PHP runs on your server. JavaScript is run by the browser, on the web surfer's computer, millions of miles away, and long after PHP has finished its work and gone away. -- 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
[PHP] PHP / JavaScript integration
Hi, I'm trying to integrate some JavaScript functions in PHP, but so far, no good :( I want to have a js.php file that has the JavaScript functions i want to use. This file, albeit its extension, has no PHP code or even tag. It's just like this: js.php -- script language=JavaScript function def(word) { if (word == 'all_not_filled') { type = 'error1'; definition = 'You didn't filled all form fields.'; } myFloater = window.open(filename,'myWindow','scrollbars=no,status=no,width=300,height=200') } /script -- Now... i want to call this JavaScript function from the regular PHP files. In particular, before the HTML code. Like this: index.php -- ?php if (condition) def('all_not_filled') // def is a JS function in js.php ? HTML HEAD (...) /HTML -- How can i do this ? How to tell PHP, that def(word) is a JS function in js.php file ? I've tried include ('js.php'), etc., but got no results :( Any help would be apreciated. Best regards, Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP / JavaScript integration
On Wed, Mar 09, 2005 at 12:27:39AM +, M?rio Gamito wrote: Hi, I'm trying to integrate some JavaScript functions in PHP, but so far, no good :( I want to have a js.php file that has the JavaScript functions i want to use. This file, albeit its extension, has no PHP code or even tag. It's just like this: js.php -- script language=JavaScript function def(word) { if (word == 'all_not_filled') { type = 'error1'; definition = 'You didn't filled all form fields.'; } myFloater = window.open(filename,'myWindow','scrollbars=no,status=no,width=300,height=200') } /script -- Now... i want to call this JavaScript function from the regular PHP files. In particular, before the HTML code. Like this: index.php -- ?php if (condition) def('all_not_filled') // def is a JS function in js.php ? HTML HEAD (...) /HTML -- How can i do this ? How to tell PHP, that def(word) is a JS function in js.php file ? I've tried include ('js.php'), etc., but got no results :( why not use a script include instead of a php one? ie: script language=javascript src=js.php from inside your index.php page? seems to make sense, since there is no php in the js file. just a thought, gabe. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP / JavaScript integration
Mário Gamito mailto:[EMAIL PROTECTED] on Tuesday, March 08, 2005 4:28 PM said: I'm trying to integrate some JavaScript functions in PHP, but so far, no good :( [snip] Now... i want to call this JavaScript function from the regular PHP files. In particular, before the HTML code. Like this: [snip] How can i do this ? How to tell PHP, that def(word) is a JS function in js.php file ? I've tried include ('js.php'), etc., but got no results :( You don't and you can't. PHP does not interact with the client (like you are thinking it does) and Javascript does not interact with the server. They are completely different and not related, except that PHP can send Javascript to the client for the client to interpret. It's a bit confusing at first but once you understand it, you'll wonder why it ever didn't make sense. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP + Javascript, immediate database update
Hi everyone, I have a webform which my users are expecting to act like a Windows program, they only need to check the box and it is automatically written to the database. So I'd like to use a combination of javascript, like this, but it isn't quite elegent enough: - Tick the box. - Javascript opens up a popup window, SQL query is made, popup window closes again Or a second method: - Register an onexit() function, and auto-submit the form. The only problem there is to remember to redirect them to their intended destination, after having submitted the form. (i.e. they pressed back, forward, or entered in another URL). Can anybody point me in the right direction? Many thanks, Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP + Javascript, immediate database update
I have a webform which my users are expecting to act like a Windows program, they only need to check the box and it is automatically written to the database. you could try this http://developer.apple.com/internet/webcontent/iframe.html or this http://jibbering.com/2002/4/httprequest.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP JavaScript
Hi everybody! Have somebody any idea how I could do something like that? ? settype($phpScreenWidth, string); settype($phpScreenHeight, string); ? script language=javascript var phpScreenWidth, phpScreenHight; phpScreenWidth = screen.width; phpScreenHeight = screen.height; /script ? echo Width:|.$phpScreenWidth.|br; echo Height:|.$phpScreenHeight.|br; ? I know that this code is not working, it is just to see what I want to do. If somebody know a solution, like this, then please let me know. What are you trying do? Are you trying to pass to PHP the user's screen width and height ? Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP JavaScript
Exactly. but it should be only with one step. That means, just running the file once and get the vars. cbq -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED] Sent: Donnerstag, 23. Oktober 2003 03:00 To: 'BQ777'; [EMAIL PROTECTED] Subject: RE: [PHP] PHP JavaScript Hi everybody! Have somebody any idea how I could do something like that? ? settype($phpScreenWidth, string); settype($phpScreenHeight, string); ? script language=javascript var phpScreenWidth, phpScreenHight; phpScreenWidth = screen.width; phpScreenHeight = screen.height; /script ? echo Width:|.$phpScreenWidth.|br; echo Height:|.$phpScreenHeight.|br; ? I know that this code is not working, it is just to see what I want to do. If somebody know a solution, like this, then please let me know. What are you trying do? Are you trying to pass to PHP the user's screen width and height ? Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP JavaScript
Martin Towell [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi everybody! Have somebody any idea how I could do something like that? ? settype($phpScreenWidth, string); settype($phpScreenHeight, string); ? This is a serverside process This says the var $phpScreenWidth and the var $phpScreenHeight are to be strings. At this point they have no value associated with them. This is done on your server, *before* the page is given to the user... script language=javascript var phpScreenWidth, phpScreenHight; phpScreenWidth = screen.width; phpScreenHeight = screen.height; /script This is a clientside process This retrieves the width and height of the users browser window and drops that value into 2 JavaScript variables. This is done on the clinets browser, *after* the page is given to the user... ? echo Width:|.$phpScreenWidth.|br; echo Height:|.$phpScreenHeight.|br; ? This is a serverside process this displays the values of the vars $phpScreenWidth and $phpScreenHeight. This varaibles do *not* have any values. This is done on your server, *before* the page is given to the user... I know that this code is not working, it is just to see what I want to do. ASSUPTION: all 3 sections are on the same PHP page to be servered. Section #1 and #3 will be processed on the server *before* the page is given to the user. Section #2 will be processed on the clients browser *after* the page is given to the user. Your trying to clean the dinner dishes *before* you've set the table for dinner. It looks like you want to know the width and height of the clients browser window. And you want your PHP process to know this so it can do some magic. Well, first your going to have to serve up a page that retrieves that info, via JavaScript, places that info in 2 HIDDEN form objects, SUBMIT that info back to your PHP process and pull that data from the POST variables. *Then* you can do your magic in PHP with these values. Or, you can translate your magic into JavaScript and let JS do your magic on the clients browser. Does this help you? Walter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP JavaScript
Hi everybody! Have somebody any idea how I could do something like that? ? settype($phpScreenWidth, string); settype($phpScreenHeight, string); ? script language=javascript var phpScreenWidth, phpScreenHight; phpScreenWidth = screen.width; phpScreenHeight = screen.height; /script ? echo Width:|.$phpScreenWidth.|br; echo Height:|.$phpScreenHeight.|br; ? I know that this code is not working, it is just to see what I want to do. If somebody know a solution, like this, then please let me know. greetZ CBQ
Re: [PHP] PHP JavaScript
Have somebody any idea how I could do something like that? snip javascript and PHP You're somewhat out of luck, as the chain of events in your typical HTTP transaction looks something like this... [time]- client request received from browser | +- PHP code executed on server | +- text output to webserver (including javascript source) | +- [drawing of cloud representing internet] | +- text input to web browser on client side | +- javascript executed by client [time]- ...The only way to have the javascript affect the PHP, is to make a subsequent request /back/ to the server after the javascript has started executing. You can, for example, package the screen size into a GET variable appended to an image request. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [PHP-WIN] Re: [PHP] PHP JavaScript
Oh I see. Well I thought that, but I wasn't sure. Ok I will do this way. No I have an direction :) Thanks a lot. -Original Message- From: Mike Migurski [mailto:[EMAIL PROTECTED] Sent: Donnerstag, 23. Oktober 2003 03:11 To: BQ777 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-WIN] Re: [PHP] PHP JavaScript Have somebody any idea how I could do something like that? snip javascript and PHP You're somewhat out of luck, as the chain of events in your typical HTTP transaction looks something like this... [time]- client request received from browser | +- PHP code executed on server | +- text output to webserver (including javascript source) | +- [drawing of cloud representing internet] | +- text input to web browser on client side | +- javascript executed by client [time]- ...The only way to have the javascript affect the PHP, is to make a subsequent request /back/ to the server after the javascript has started executing. You can, for example, package the screen size into a GET variable appended to an image request. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP Windows 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
RES: [PHP] PHP/JavaScript/HTML
Perfect! That's all I had to do. Thanks! Maurício -Mensagem original- De: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 5 de agosto de 2003 16:30 Para: Mauricio; [EMAIL PROTECTED] Assunto: Re: [PHP] PHP/JavaScript/HTML From: Mauricio [EMAIL PROTECTED] On the Address Bar I can see: index.php?slcAdd=1slcAdd=2slcAdd=3 But when I get the value using $HTTP_GET_VARS['slcAdd']; it returns just the last value. What can I do to get them all? Name your select box as slcAdd[] and you'll have all of the values in an array. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.510 / Virus Database: 307 - Release Date: 14/8/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.510 / Virus Database: 307 - Release Date: 14/8/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/JavaScript/HTML
Ok! Now I can see the values in the another page. But each value are passed with the same name. How can I get all values using PHP script? On the Address Bar I can see: index.php?slcAdd=1slcAdd=2slcAdd=3 But when I get the value using $HTTP_GET_VARS['slcAdd']; it returns just the last value. What can I do to get them all? Thanks! .:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. Maurício Alegre Valente AGP5 Tecnologia da Informação Ltda. (48) 439-3004 Visite nosso site: www.agp5.com.br .:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. - Original Message - From: CPT John W. Holmes [EMAIL PROTECTED] To: Mauricio [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 10:05 AM Subject: Re: [PHP] PHP/JavaScript/HTML From: Mauricio [EMAIL PROTECTED] I wrote a JavaScript to set the values of a Select html object by client side. The values are copied from another Select that I create getting the values from the database. After the user set the values he/she wants to add it in another form, for example, then press submit button, the values of the user Select object doesn't appears on the next page. What can I do to get the user selected values in the another page? Well, if I understand that correctly, you need to use Javascript to select all of the options that the user selected to add to the second select box. If they aren't selected, then they won't be passed to the next page. ---John Holmes... -- 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] PHP/JavaScript/HTML
Hello folks I wrote a JavaScript to set the values of a Select html object by client side. The values are copied from another Select that I create getting the values from the database. After the user set the values he/she wants to add it in another form, for example, then press submit button, the values of the user Select object doesn't appears on the next page. What can I do to get the user selected values in the another page? Someone could help me? Thanks! .:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. Maurício Alegre Valente AGP5 Tecnologia da Informação Ltda. (48) 439-3004 Visite nosso site: www.agp5.com.br .:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. - Original Message - From: Nicholas Robinson [EMAIL PROTECTED] To: skate [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 4:26 AM Subject: Re: [PHP] easier than switch As, in this case, only one of the variables is non-null, then you could use the string concatenation operator and this would return what you want. i.e. type = $_POST['news'] . $_POST['dreams'] . $_POST['storys']... I think I've used the same variable name in different forms on the same page, as only one form submission occurs at any one time there can't be a conflict and PHP doesn't care where the POST'ed variable came from.. So, you could rename news, dreams, etc. to be type and extract the result directly without having to fiddle around. HTH Nick On Monday 04 Aug 2003 11:19 pm, skate wrote: okay, so i know there's an easy way to do this, and i've seen it done, sure of it. so please forgive the stupidity of my question, i don't even know where to begin to look in the archives either... i have several forms on one page, they all submit a different variable, i then want to set one variable depending on that... okay, now i'm confusing myself, lets try explain it with some code... ? if(isset($_POST)) { $type = $_POST['news'] || $_POST['dreams'] || $_POST['storys'] || $_POST['words'] || $_POST['chat']; } ? obviously this doesn't work. but i wanna set $type depending on which $_POST variable was sent. only one of these will ever be sent. rather than doing a big ass switch statement, is there no way i can get this into one line? i hope this isn't too confusing... -- 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/JavaScript/HTML
From: Mauricio [EMAIL PROTECTED] I wrote a JavaScript to set the values of a Select html object by client side. The values are copied from another Select that I create getting the values from the database. After the user set the values he/she wants to add it in another form, for example, then press submit button, the values of the user Select object doesn't appears on the next page. What can I do to get the user selected values in the another page? Well, if I understand that correctly, you need to use Javascript to select all of the options that the user selected to add to the second select box. If they aren't selected, then they won't be passed to the next page. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/JavaScript/HTML
From: Mauricio [EMAIL PROTECTED] On the Address Bar I can see: index.php?slcAdd=1slcAdd=2slcAdd=3 But when I get the value using $HTTP_GET_VARS['slcAdd']; it returns just the last value. What can I do to get them all? Name your select box as slcAdd[] and you'll have all of the values in an array. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP, JavaScript and populating DropDowns
Thanks very much John. It looks great. Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -Original Message- From: John Manko [mailto:[EMAIL PROTECTED] Sent: July 29, 2003 2:49 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Php. Net Subject: Re: [PHP] PHP, JavaScript and populating DropDowns assuming you have a table with colors, and each color has car associated with it (yes, there might be dup color entries). This should work (check spellings and case, etc..etc...) $query=SELECT * from colors; $results = mysql_query($query) or die (DB ERROR: . mysql_error()); $num = mysql_numrows($results); $i=0; echo script language=javascript\n!--\n; while ($i $num) { echo \n ca[$i] = new Array();; echo \n ca[$i][0] = \ . mysql_result($results,$i,CarID) . \;; echo \n ca[$i][1] = \ . mysql_result($results,$i,ColorID) . \;; echo \n ca[$i][2] = \ . mysql_result($results,$i,ColorName) . \;\n; ++$i; } echo function changeColor(ns) {var SelectColor, NumEntries, i; for (i = document.form1.selectcolor.length; i 0; i--) { document.addform.selectcolor.options[i-1] = null; } document.form1.selectcolor.options[0] = new Option(-- Select Color --,0); len = 0; if (ns != 0) { NumEntries = ca.length for (i = 0; i NumEntries; i++) { if(ca[i][0] == ns){ len++; document.form1.selectcolor.options[len] = new Option(ca[i][2],ca[i][1]); } } } document.form1.selectcolor.selectedIndex = 0; } ; echo \n//--\n/script\n; this in later in the page... $query=SELECT * from car; $results = mysql_query($query) or die(brERROR - Please Contact Site Administratorbr); $num = mysql_numrows($results); $i=0; echo select onchange='changeColor(this.value);' name='selectcar'option value='0'Select Car/option; while ($i $num) { $id=mysql_result($results,$i,CarID); $name=mysql_result($results,$i,CarName); echo option value='$id'$name/option; ++$i; } echo /select; echo select name=selectcoloroption value='0'-- Select Color --/option/select; --- Creative Solutions New Media wrote: Hello, I am using mySQL and PHP to pull some data into my page. I have 2 dropdown boxes. As an example lets say dropbox1 has a list of cars and dropbox2 has a list of colours. Here's the thing. The colours for each car vary so I won't know what colours to populate the 2nd dropbox with until a car is chosen. I really want this all contained on 1 page. Is there a standard way of dealing with this? The only thing I can think of is to reload the page once the make of car is selected which would give me the opportunity to populate the 2nd drop box at that time but that doesn't seem like a good solution. I don't know much in the way of JS but is there a way to do what I need that way? Thanks. Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -- 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] PHP, JavaScript and populating DropDowns
Hello, I am using mySQL and PHP to pull some data into my page. I have 2 dropdown boxes. As an example lets say dropbox1 has a list of cars and dropbox2 has a list of colours. Here's the thing. The colours for each car vary so I won't know what colours to populate the 2nd dropbox with until a car is chosen. I really want this all contained on 1 page. Is there a standard way of dealing with this? The only thing I can think of is to reload the page once the make of car is selected which would give me the opportunity to populate the 2nd drop box at that time but that doesn't seem like a good solution. I don't know much in the way of JS but is there a way to do what I need that way? Thanks. Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP, JavaScript and populating DropDowns
assuming you have a table with colors, and each color has car associated with it (yes, there might be dup color entries). This should work (check spellings and case, etc..etc...) $query=SELECT * from colors; $results = mysql_query($query) or die (DB ERROR: . mysql_error()); $num = mysql_numrows($results); $i=0; echo script language=javascript\n!--\n; while ($i $num) { echo \n ca[$i] = new Array();; echo \n ca[$i][0] = \ . mysql_result($results,$i,CarID) . \;; echo \n ca[$i][1] = \ . mysql_result($results,$i,ColorID) . \;; echo \n ca[$i][2] = \ . mysql_result($results,$i,ColorName) . \;\n; ++$i; } echo function changeColor(ns) {var SelectColor, NumEntries, i; for (i = document.form1.selectcolor.length; i 0; i--) { document.addform.selectcolor.options[i-1] = null; } document.form1.selectcolor.options[0] = new Option(-- Select Color --,0); len = 0; if (ns != 0) { NumEntries = ca.length for (i = 0; i NumEntries; i++) { if(ca[i][0] == ns){ len++; document.form1.selectcolor.options[len] = new Option(ca[i][2],ca[i][1]); } } } document.form1.selectcolor.selectedIndex = 0; } ; echo \n//--\n/script\n; this in later in the page... $query=SELECT * from car; $results = mysql_query($query) or die(brERROR - Please Contact Site Administratorbr); $num = mysql_numrows($results); $i=0; echo select onchange='changeColor(this.value);' name='selectcar'option value='0'Select Car/option; while ($i $num) { $id=mysql_result($results,$i,CarID); $name=mysql_result($results,$i,CarName); echo option value='$id'$name/option; ++$i; } echo /select; echo select name=selectcoloroption value='0'-- Select Color --/option/select; --- Creative Solutions New Media wrote: Hello, I am using mySQL and PHP to pull some data into my page. I have 2 dropdown boxes. As an example lets say dropbox1 has a list of cars and dropbox2 has a list of colours. Here's the thing. The colours for each car vary so I won't know what colours to populate the 2nd dropbox with until a car is chosen. I really want this all contained on 1 page. Is there a standard way of dealing with this? The only thing I can think of is to reload the page once the make of car is selected which would give me the opportunity to populate the 2nd drop box at that time but that doesn't seem like a good solution. I don't know much in the way of JS but is there a way to do what I need that way? Thanks. Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php - javascript together prob?
Anyone have an idea of how to get this to work? Its the onClick part that wont work. I know if I pull it out of PHP it works just fine but I need it part of the script as I have a loop that it runs under. echo (td width=50%a href='' onClick='javascript:window.open (v_images/dsp_img_viewer.php?$image_loc, imageView, height=350,width=450, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, directories=no,status=no);'); I considered and tried sending it to a js function but it doesn't like not having the but I need the quotes in the echo statement to read in the variables passed to it. thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php - javascript together prob?
Since you had problems with quotes yesterday too, I would suggest reading the manual page on strings so you do not continue to have the same problems day after day. http://www.php.net/manual/en/language.types.string.php -Original Message- From: Micah Montoy [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 2:51 PM To: [EMAIL PROTECTED] Subject: [PHP] php - javascript together prob? Anyone have an idea of how to get this to work? Its the onClick part that wont work. I know if I pull it out of PHP it works just fine but I need it part of the script as I have a loop that it runs under. echo (td width=50%a href='' onClick='javascript:window.open (v_images/dsp_img_viewer.php?$image_loc, imageView, height=350,width=450, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, directories=no,status=no);'); I considered and tried sending it to a js function but it doesn't like not having the but I need the quotes in the echo statement to read in the variables passed to it. thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php - javascript together prob?
U need to quote it with double quotes and escape them with like so: \ that should work for you. If not then you will need to start separating the string out and joining it with the . . -- BigDog On Wed, 2003-07-09 at 15:51, Micah Montoy wrote: Anyone have an idea of how to get this to work? Its the onClick part that wont work. I know if I pull it out of PHP it works just fine but I need it part of the script as I have a loop that it runs under. echo (td width=50%a href='' onClick='javascript:window.open (v_images/dsp_img_viewer.php?$image_loc, imageView, height=350,width=450, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, directories=no,status=no);'); I considered and tried sending it to a js function but it doesn't like not having the but I need the quotes in the echo statement to read in the variables passed to it. thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP/Javascript Help
-Original Message- From: Stephen [mailto:[EMAIL PROTECTED] Sent: 06 June 2003 15:48 Thanks for your reply. I had actually made a mistake in the code. It looks like this now: How could I still use the id thing on this? Well, the addition of the stripslashes() call doesn't really change the basic idea, so: print a href=\#\ onClick=\window.opener.document.order[' . stripslashes($HTTP_GET_VARS['name']) . ].value='$y-$m-$d';\$d/a; I now use ' in the brakets as well, if that helps any... I'm not sure I quite understand this, but if you're saying that the value of $HTTP_GET_VARS['name'] may itself include ' characters, then I think the answer to that is *not* to stripslashes() it -- JavaScript will understand the backslashed notations and convert them to the correct result. If that's not what you were getting at, please try explaining it again in a bit more detail (adding an example might help). Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/Javascript Help
Hello, I'm trying to use a calendare script to select a date in another form. I got the calendar working and I've got it all working except one bit of error. I'm repeating a table field to get all these items into a table. Each row of the table has it's own text field where the user can type in when they want the item to be delivered. That's where the calendar comes in. It opens a new window, displays the calendar, and that's that. The problem I'm having is when the user click the date, they get an error, one of those Expected ] on line whatever. I can see what the problem is. Since I repeat the form field, I made the field's name delivery[item_id] and item_id is replaced with the item's id currently being displayed. I need to keep this array so, how can I fix this error? I tried doing the \[ trick since that works with apostrpohes but it didn't seem to work. Any help would be great! Here's my javascript link code for each day of the month in the calendar script: print a href=\#\ onClick=\window.opener.document..$HTTP_GET_VARS['name']..date.value='$y-$m-$d';\$d/a; $HTTP_GET_VARS['name'] holds the text field name, ie delivery[3322ffds]. If I replace the name either order in the text field and as the variable I pass in the URL it works fine. I'm not yours, so why should I be sincere about it, Stephen Craton Senior Executive Web Developer Mophus.com, Inc.
RE: [PHP] PHP/Javascript Help
-Original Message- From: Stephen [mailto:[EMAIL PROTECTED] Sent: 05 June 2003 19:15 Here's my javascript link code for each day of the month in the calendar script: print a href=\#\ onClick=\window.opener.document..$HTTP_GET_VARS['name']..da te.value='$y-$m-$d';\$d/a; $HTTP_GET_VARS['name'] holds the text field name, ie delivery[3322ffds]. If I replace the name either order in the text field and as the variable I pass in the URL it works fine. You need to make use of the JavaScript ['id'] identity with .id (see any good JavaScript book for more on this), thus: print a href=\#\ onClick=\window.opener.document[' . $HTTP_GET_VARS['name'] . '].date.value='$y-$m-$d';\$d/a; Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/Javascript Help
Thanks for your reply. I had actually made a mistake in the code. It looks like this now: print a href=\#\ onClick=\window.opener.document.order..stripslashes($HTTP_GET_VARS['name'] )..value='$y-$m-$d';\$d/a; How could I still use the id thing on this? I now use ' in the brakets as well, if that helps any... I'm not yours, so why should I be sincere about it, Stephen Craton Senior Executive Web Developer Mophus.com, Inc. - Original Message - From: Ford, Mike [LSS] [EMAIL PROTECTED] To: 'Stephen' [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Sent: Friday, June 06, 2003 4:22 AM Subject: RE: [PHP] PHP/Javascript Help -Original Message- From: Stephen [mailto:[EMAIL PROTECTED] Sent: 05 June 2003 19:15 Here's my javascript link code for each day of the month in the calendar script: print a href=\#\ onClick=\window.opener.document..$HTTP_GET_VARS['name']..da te.value='$y-$m-$d';\$d/a; $HTTP_GET_VARS['name'] holds the text field name, ie delivery[3322ffds]. If I replace the name either order in the text field and as the variable I pass in the URL it works fine. You need to make use of the JavaScript ['id'] identity with .id (see any good JavaScript book for more on this), thus: print a href=\#\ onClick=\window.opener.document[' . $HTTP_GET_VARS['name'] . '].date.value='$y-$m-$d';\$d/a; Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- 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] php javascript problem
Hello friends. I need to control the users viewing from one location so that when I change the URL string in a text file, the viewers page which has a timer automatically reads the URL on the text pages and goes to that page. Updating the textfile is ok. But below is the script onthe page which I want to reload every 10 seconds and display the name of the new page and go there. There are two problems, when the page reloads, the PHP script that gets the new URL from the text file does not seem to run. Can someone please tell me where I am wrong? Thanks very much. Denis ?php $fo=fopen(currenttext.txt,r+); $currenturl=fgets($fo,128); $currenturl=\.$currenturl.\; Print $currenturl; Printform name=\frmurl\; Printinput type=\hidden\ name=\currenturl\ size=\4\ value=$currenturl ; Print input type=\text\ name=\clock\ size=\4\; Printform; fclose($fo); ? html head SCRIPT LANGUAGE=Javascript !-- var x = 10 var y = 1 var url= document.frmurl.currenturl.value; function startClock(){ x = x-y document.frmurl.clock.value = x setTimeout(startClock(), 1000) if(x==0){ location=url //window.location.reload() //document.frmurl.clock.value = 10 //x=10; } } //-- /script
[PHP] PHP JavaScript
I have a problem with 2 select multiple boxes in my PHP pages. In order for PHP to pass multiple values to a page that it is posted to, the name of the select box must have [] at the end of it. My problem is that when I do that for select1[] in my page that breaks the syntax of the JavaScript code that performs operations on it. Is there any way around this? I'm looking for either a PHP or a JavaScript solution. Thanks, Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP JavaScript
document.forms[0].elements['select1[]'] Assuming the form is your first form on the page, reference the element in JavaScript as above. Greg wrote: I have a problem with 2 select multiple boxes in my PHP pages. In order for PHP to pass multiple values to a page that it is posted to, the name of the select box must have [] at the end of it. My problem is that when I do that for select1[] in my page that breaks the syntax of the JavaScript code that performs operations on it. Is there any way around this? I'm looking for either a PHP or a JavaScript solution. Thanks, Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php javascript drop down menu???
thanks Jason, between this the other suggestions I was emailed I believe I can make this all work like I need to. Jeff Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Wednesday 12 February 2003 08:47, Jeff Bluemel wrote: OK... I have a dynamic menu system, and I have to maintain a dynamic menu. however, the amount of content I need in my menu is going to be rapidly outgrown. I believe my only solution is to deploy a javascript drop down menu (users have to be javascript compatible anyway for some other issues in my pages). however, it seems like anytime I try to integrate php javascript I run into a total nightmare. the php javascript do not need to integrate at the client level, but just on the server side to actually deploy the menu to the user. (have if then statements of info from a database that will determine if the item is displayed to the user or not, so should be pretty easy to accomodate) does anybody have any sample code of a javascript menu across the top of the page that will have menu, and submenu's they are deploying with php echo statements? Try this: http://phplayersmenu.sourceforge.net/ -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* The difference between this place and yogurt is that yogurt has a live culture. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP JavaScript
Thank you so much, that worked perfectly...I know it's off topic, but do you know how to automatically select all elements of a select multiple box and then submit the form using a submit button? Thanks! -Greg John Nichel [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... document.forms[0].elements['select1[]'] Assuming the form is your first form on the page, reference the element in JavaScript as above. Greg wrote: I have a problem with 2 select multiple boxes in my PHP pages. In order for PHP to pass multiple values to a page that it is posted to, the name of the select box must have [] at the end of it. My problem is that when I do that for select1[] in my page that breaks the syntax of the JavaScript code that performs operations on it. Is there any way around this? I'm looking for either a PHP or a JavaScript solution. Thanks, Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php javascript drop down menu???
OK... I have a dynamic menu system, and I have to maintain a dynamic menu. however, the amount of content I need in my menu is going to be rapidly outgrown. I believe my only solution is to deploy a javascript drop down menu (users have to be javascript compatible anyway for some other issues in my pages). however, it seems like anytime I try to integrate php javascript I run into a total nightmare. the php javascript do not need to integrate at the client level, but just on the server side to actually deploy the menu to the user. (have if then statements of info from a database that will determine if the item is displayed to the user or not, so should be pretty easy to accomodate) does anybody have any sample code of a javascript menu across the top of the page that will have menu, and submenu's they are deploying with php echo statements? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php javascript drop down menu???
On Wednesday 12 February 2003 08:47, Jeff Bluemel wrote: OK... I have a dynamic menu system, and I have to maintain a dynamic menu. however, the amount of content I need in my menu is going to be rapidly outgrown. I believe my only solution is to deploy a javascript drop down menu (users have to be javascript compatible anyway for some other issues in my pages). however, it seems like anytime I try to integrate php javascript I run into a total nightmare. the php javascript do not need to integrate at the client level, but just on the server side to actually deploy the menu to the user. (have if then statements of info from a database that will determine if the item is displayed to the user or not, so should be pretty easy to accomodate) does anybody have any sample code of a javascript menu across the top of the page that will have menu, and submenu's they are deploying with php echo statements? Try this: http://phplayersmenu.sourceforge.net/ -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* The difference between this place and yogurt is that yogurt has a live culture. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Javascript compatibilty
Hi all, I'm developing a WYSIWYG editor using PHP and Javascript (for COM). However, I start having problems when I try to display the page using the .php extension. The Javascript is not working. However, when I save it to HTML, it worked fine. Can anyone please help me? Why is this so? What can I do to get Javascript working with PHP with ease? Any articles on this? Thanks a lot... again. :) Yours, Wee Keat Chin -- If you cannot win, make the one ahead of you break the record.
RE: [PHP] php + javascript hard day together ?
-Original Message- From: David D [mailto:[EMAIL PROTECTED]] Sent: 13 July 2002 16:38 I can manage this script to work. Js warn about listid[], he doesnt like [] in a var name ! Php needs them to collect an array from form checkboxes. form name=test action=check.php input type=button value=partout onClick=this.value=check(this.form.listid[])br use this.form['listid[]'] It seems to be a very little known fact that, by definition, the JavaScript construct x.y is identical to x['y'] so an extended accessor such as w.x.y.z could also be written equally validly in any of the following ways: w.x.y['z'] w.x['y'].z w['x'].y.z w['x'].y['z'] w['x']['y'].z and several other similar combinations! (And, yes, that means that this['form']['listid[]'] should be valid, too!) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php + javascript hard day together ?
Hi all, I can manage this script to work. Js warn about listid[], he doesnt like [] in a var name ! Php needs them to collect an array from form checkboxes. Here is my source : !doctype html public -//W3C//DTD HTML 4.0 //EN html head titleTitle here!/title 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 nowhere; } else { for (i = 0; i field.length; i++) { field[i].checked = false; } checkflag = false; return everywhere; } } /script /head body ? print_r($listid); // what in listid ? ? form name=test action=check.php input type=button value=partout onClick=this.value=check(this.form.listid[])br input type=checkbox name=listid[] value=11br input type=checkbox name=listid[] value=22br input type=submit /form script var obj=eval('document.test.listid[]'); alert(obj); // no object ! /script /body /html Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php + javascript hard day together ?
On Saturday 13 July 2002 23:37, David D wrote: Hi all, I can manage this script to work. Js warn about listid[], he doesnt like [] in a var name ! There's nothing you can do about that. Php needs them to collect an array from form checkboxes. You'll just have to rename your checkboxes to something like listid_1, listid_2 etc. Then loop: # Untested code, use with caution for ($i = 1; $i $number_of_checkboxes; $i++) { if (isset($_GET[listid_$i])) { echo listid_$i is checkedbr; } } -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Bunker's Admonition: You cannot buy beer; you can only rent it. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php + javascript hard day together ?
I hack js no need to change in php : SCRIPT LANGUAGE=JavaScript !-- Begin var checkflag = false; // on va se ballader parmis les elements de formualire et toucher // au case a cocher function check(formulaire) { if (checkflag == false) { for (i = 0; i formulaire.length; i++) { if (formulaire.elements[i].type.toLowerCase() == 'checkbox') { formulaire.elements[i].checked = true; } } checkflag = true; return Nulpart; } else { for (i = 0; i formulaire.length; i++) { if (formulaire.elements[i].type.toLowerCase() == 'checkbox') { formulaire.elements[i].checked = false; } } checkflag = false; return Partout; } } /script I pass teh form to the function and scan its elements -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php JavaScript
check out the reply he sent to my last message. it had the code as an attachment. Jim Lucas - Original Message - From: David Freeman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 24, 2002 2:25 PM Subject: RE: [PHP] php JavaScript I've tried to include a simple javascript in a .php file, but couldn't get it to work. Actually not even the php code worked at all... Is there any specific configuration flag that needs to be set up in the Apache server so that the javascripts work correctly? Not particularly, but if you could show some sample code of what you're doing... FWIW, I include javascript stuff in my php all the time. CYA, Dave -- 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] php JavaScript
Hi there. I've tried to include a simple javascript in a .php file, but couldn't get it to work. Actually not even the php code worked at all... Is there any specific configuration flag that needs to be set up in the Apache server so that the javascripts work correctly? Thanks in advance Luis PS- Btw, I use an Apache server on a RH72 machine -- Luis Miguel N. Távora [EMAIL PROTECTED] Message sent via Sylpheed sylpheed-claws.sourceforge.net -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php JavaScript
Can you please explain what you're doing more? PHP and Javascript are completely different. PHP happens first, on the web server, to create code to send to the browser. The browser then interprets this code, executes any javascript, etc, and displays the page. You can't have both at the same time. Each one can send information back to the other, but it needs to happen with a page refresh... Are you sure your server is even set up for PHP? ---John Holmes... - Original Message - From: Luis Miguel N. Tavora [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 24, 2002 7:28 AM Subject: [PHP] php JavaScript Hi there. I've tried to include a simple javascript in a .php file, but couldn't get it to work. Actually not even the php code worked at all... Is there any specific configuration flag that needs to be set up in the Apache server so that the javascripts work correctly? Thanks in advance Luis PS- Btw, I use an Apache server on a RH72 machine -- Luis Miguel N. Távora [EMAIL PROTECTED] Message sent via Sylpheed sylpheed-claws.sourceforge.net -- -- 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 JavaScript
nope, theres nothing in apache that needs to be setup for js to be used. does your js file have any php in it? when you say that you couldn't get it to work, do you mean that the include doesn't work or that the js doesn't work on the page that you are including it to? Jim Lucas - Original Message - From: Luis Miguel N. Tavora [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 24, 2002 4:28 AM Subject: [PHP] php JavaScript Hi there. I've tried to include a simple javascript in a .php file, but couldn't get it to work. Actually not even the php code worked at all... Is there any specific configuration flag that needs to be set up in the Apache server so that the javascripts work correctly? Thanks in advance Luis PS- Btw, I use an Apache server on a RH72 machine -- Luis Miguel N. Távora [EMAIL PROTECTED] Message sent via Sylpheed sylpheed-claws.sourceforge.net -- -- 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 JavaScript
I've tried to include a simple javascript in a .php file, but couldn't get it to work. Actually not even the php code worked at all... Is there any specific configuration flag that needs to be set up in the Apache server so that the javascripts work correctly? Not particularly, but if you could show some sample code of what you're doing... FWIW, I include javascript stuff in my php all the time. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php, javascript
Just a general question. Is it possible to embed php in pure javascript/dhtml code?? I tried but it didn't work, not sure if it was me or its not possible. Thanks... -- Gerard Samuel http://www.trini0.org:81/ http://dev.trini0.org:81/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php, javascript
On Friday 31 May 2002 13:18, Gerard Samuel wrote: Just a general question. Is it possible to embed php in pure javascript/dhtml code?? I tried but it didn't work, not sure if it was me or its not possible. Thanks... As long as you enclose the PHP code in script delimiters (?php ... ?) and make sure it is interpreted before sending it back to the browser, it should work. Show us the code you're trying that didn't work. Maybe we can give more meaningful answers. ..michael.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PhP Javascript Mixed Repost Fields
Here is a problem :-) A php post form fooa.php Submit all form fields to a page foob.php Page foob.php do some mysql db check and in one condition I want to Return to fooa.php without losing any field value... I made this from foob.php with header:(location:fooa.php?field1=$field1field2=$field2.etc) But this is more complex esspecially when in fooa.php there are radio buttons + checkboxes. I thing that if I could with Javascript in foob.php create an (invisble) form and take all posted fields from Fooa.php And resubmit it with form.submit method to fooa.php I will have best results But I dont know how to do this since I am a begginer.. Anyone can help please send me an email Thanks in advnace for your time help and excuse me if is off topic Best Regads simos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PhP Javascript Mixed Repost Fields
That seems like over complicating the problem to me. Why not just include the original query string that was passed from fooa.php by: header(Location:foa.php?$QUERY_STRING) -Jackson On Mon, 2002-04-01 at 12:28, Simos Varelakis wrote: Here is a problem :-) A php post form fooa.php Submit all form fields to a page foob.php Page foob.php do some mysql db check and in one condition I want to Return to fooa.php without losing any field value... I made this from foob.php with header:(location:fooa.php?field1=$field1field2=$field2.etc) But this is more complex esspecially when in fooa.php there are radio buttons + checkboxes. I thing that if I could with Javascript in foob.php create an (invisble) form and take all posted fields from Fooa.php And resubmit it with form.submit method to fooa.php I will have best results But I dont know how to do this since I am a begginer.. Anyone can help please send me an email Thanks in advnace for your time help and excuse me if is off topic Best Regads simos -- 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-JavaScript
Or get the JS to rewrite a query string in a link, but personally I wouldn't rely on JS that far. Tim www.chessish.com http://www.chessish.com -- From: Richard Crawford [SMTP:[EMAIL PROTECTED]] Sent: 20 January 2002 23:32 To: Mårten Andersson Cc: [EMAIL PROTECTED] Subject: Re: [PHP] PHP-JavaScript In a word... No. Well... No. Mårten Andersson wrote: Is it posible to get values from javascript to PHP? Without having to post the variables.. Thanks //Mårten _ Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- 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-JavaScript
Unfortunately, that won't work if the value of the JS variable needs to change dynamically based on user interaction; document.write() only works as the page is loaded (well... MSIE might be different, but writing MSIE-only code is a bad practice). The best bet is to use an input field; input fields can change dynamically, and the value can be captured using JS's DOM. But there is absolutely no way around the fact that to send a JS variable to a PHP script, you must send that variable back to the server via POST or GET. Tim Ward wrote: Or get the JS to rewrite a query string in a link, but personally I wouldn't rely on JS that far. Tim www.chessish.com http://www.chessish.com -- From: Richard Crawford [SMTP:[EMAIL PROTECTED]] Sent: 20 January 2002 23:32 To: Mårten Andersson Cc: [EMAIL PROTECTED] Subject: Re: [PHP] PHP-JavaScript In a word... No. Well... No. Mårten Andersson wrote: Is it posible to get values from javascript to PHP? Without having to post the variables.. Thanks //Mårten _ Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- 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-JavaScript
hence my qualification, but you can alter the contents of elements using javascript on the fly, using the innerHTML property, for example. Tim www.chessish.com -Original Message- From: Richard Crawford [SMTP:[EMAIL PROTECTED]] Sent: 21 January 2002 15:59 To: Tim Ward Cc: Mårten Andersson; [EMAIL PROTECTED] Subject: Re: [PHP] PHP-JavaScript Unfortunately, that won't work if the value of the JS variable needs to change dynamically based on user interaction; document.write() only works as the page is loaded (well... MSIE might be different, but writing MSIE-only code is a bad practice). The best bet is to use an input field; input fields can change dynamically, and the value can be captured using JS's DOM. But there is absolutely no way around the fact that to send a JS variable to a PHP script, you must send that variable back to the server via POST or GET. Tim Ward wrote: Or get the JS to rewrite a query string in a link, but personally I wouldn't rely on JS that far. Tim www.chessish.com http://www.chessish.com -- From: Richard Crawford [SMTP:[EMAIL PROTECTED]] Sent: 20 January 2002 23:32 To: Mårten Andersson Cc: [EMAIL PROTECTED] Subject: Re: [PHP] PHP-JavaScript In a word... No. Well... No. Mårten Andersson wrote: Is it posible to get values from javascript to PHP? Without having to post the variables.. Thanks //Mårten _ Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- 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-JavaScript
Yes, but only in MSIE. As far as I know, no other browser supports the innerHTML property; at least, I have never managed to get it to work in Netscape, Mozilla, Konquerer, or Opera. And I stand firmly behind my earlier statement that developing code that bombs on non-MSIE browsers is a bad practice. This is why I didn't recommend use of the innerHTML property. :) Tim Ward wrote: hence my qualification, but you can alter the contents of elements using javascript on the fly, using the innerHTML property, for example. Tim www.chessish.com -Original Message- From: Richard Crawford [SMTP:[EMAIL PROTECTED]] Sent: 21 January 2002 15:59 To: Tim Ward Cc: Mårten Andersson; [EMAIL PROTECTED] Subject: Re: [PHP] PHP-JavaScript Unfortunately, that won't work if the value of the JS variable needs to change dynamically based on user interaction; document.write() only works as the page is loaded (well... MSIE might be different, but writing MSIE-only code is a bad practice). The best bet is to use an input field; input fields can change dynamically, and the value can be captured using JS's DOM. But there is absolutely no way around the fact that to send a JS variable to a PHP script, you must send that variable back to the server via POST or GET. Tim Ward wrote: Or get the JS to rewrite a query string in a link, but personally I wouldn't rely on JS that far. Tim www.chessish.com http://www.chessish.com -- From: Richard Crawford [SMTP:[EMAIL PROTECTED]] Sent: 20 January 2002 23:32 To: Mårten Andersson Cc: [EMAIL PROTECTED] Subject: Re: [PHP] PHP-JavaScript In a word... No. Well... No. Mårten Andersson wrote: Is it posible to get values from javascript to PHP? Without having to post the variables.. Thanks //Mårten _ Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- 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-JavaScript
You can store the data which is in JS to PHP when submiting the page. From the Web Page which has the form, include some hidden type variables in the html form. On submit call the JS function and store the JS Data into the WEB form hidden variable and then submit it. so that your php application which process the form would get the values. I think i understood the question well... with regards, Sukumar .S On Mon, 21 Jan 2002, Tim Ward wrote: Date: Mon, 21 Jan 2002 10:20:31 - From: Tim Ward [EMAIL PROTECTED] To: [iso-8859-1] Mårten Andersson [EMAIL PROTECTED], Richard Crawford [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: [PHP] PHP-JavaScript Or get the JS to rewrite a query string in a link, but personally I wouldn't rely on JS that far. Tim www.chessish.com http://www.chessish.com -- From: Richard Crawford [SMTP:[EMAIL PROTECTED]] Sent: 20 January 2002 23:32 To: Mårten Andersson Cc: [EMAIL PROTECTED] Subject: Re: [PHP] PHP-JavaScript In a word... No. Well... No. Mårten Andersson wrote: Is it posible to get values from javascript to PHP? Without having to post the variables.. Thanks //Mårten _ Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- 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] -- A real friend is one who walks in when the rest of the world walks out -- -- 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] PHP-JavaScript
Is it posible to get values from javascript to PHP? Without having to post the variables.. Thanks //Mårten _ Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se -- 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-JavaScript
In a word... No. Well... No. Mårten Andersson wrote: Is it posible to get values from javascript to PHP? Without having to post the variables.. Thanks //Mårten _ Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- 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-JavaScript
Hi, A little trick I did to get the text from a textbox in a form ( for user comments ) without the user having to submit it was to use javascript to append the textbox contents to a url ( GET METHOD ) when the user clicked on a link, which pointed to a redirect script which extracted the textbox contents then redirected the user to the link requested. Hopefull this will give you some ideas. [page.html] script LANGUAGE=JavaScript !-- function modifyurl (theurl,textvar,thepagename) { // do validation here on textvar, textvalue, etc. then proceed with: theurl.href=redirect_script.php?requestedpage= + thepagename + textvalue= + escape(textvar); } // -- /script form name=thetextform onSubmit=return false; input type=text name=textvariable size=30 maxlength=45 /form a href=/another_page.html onClick=modifyurl(this, thetextform.textvariable.value, 'another_page') [redirect_script.php] ...and here on the redirect page I would do validation of the variables/form_contents etc., insert it into a db, and then redirect: ? switch ($requestedpage) { case another_page: Header(Location: http://www.site.com/path/to/another_page.html;); //Redirect browser break; case ... } Cheers, Bruce _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- 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] php javascript
Hey all! I'm including some javascript that enables a button in a form input type=button name=CheckAll value=Check All onClick=checkAll(document.myform.email)to check all the check boxes at once. (I have an array of check boxes from a mysql db) I use: SCRIPT LANGUAGE=JavaScript !-- Begin function checkAll(field) { for (i = 0; i field.length; i++) field[i].checked = true ; } function uncheckAll(field) { for (i = 0; i field.length; i++) field[i].checked = false ; } // End -- /script So... In order to use this script my button has to have onClick=checkAll(document.myform.email) and my check boxes have to have name=email but i need to name them name=email[] in order to pass the variables as an array in php. ive tried using onClick=checkAll(document.myform.email[]) but that just gives me an error for obvious reasons im sure. I don't know jack about javascript, so if you know of a better way to make a button that selects all check boxes or another way to code how the check boxes values are passed to the next page, I would be so greatful. Thanks! Nate
Re: [PHP] php javascript
Leave the input name as email. If you really want to call it email[], you should be able to reference this in JavaScript as the object document.myform[email[]] If you leave it as email, you can then convert the email variable into an array using explode() or split() as so: ?php // on the recieving page, of course $emailArray = explode (,, $email); // Alternatively, a bit of RE exploding... $emailArray = split (,, $email); ? Matt Hey all! I'm including some javascript that enables a button in a form input type=button name=CheckAll value=Check All onClick=checkAll(document.myform.email)to check all the check boxes at once. (I have an array of check boxes from a mysql db) I use: SCRIPT LANGUAGE=JavaScript !-- Begin function checkAll(field) { for (i = 0; i field.length; i++) field[i].checked = true ; } function uncheckAll(field) { for (i = 0; i field.length; i++) field[i].checked = false ; } // End -- /script So... In order to use this script my button has to have onClick=checkAll(document.myform.email) and my check boxes have to have name=email but i need to name them name=email[] in order to pass the variables as an array in php. ive tried using onClick=checkAll(document.myform.email[]) but that just gives me an error for obvious reasons im sure. I don't know jack about javascript, so if you know of a better way to make a button that selects all check boxes or another way to code how the check boxes values are passed to the next page, I would be so greatful. Thanks! Nate -- 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 javascript
First off thanks for the reply. When I click the test button I get Error: 'length' is null or not an object. I used script language=javascript function func( field ) { for ( i = 0; i field.length; i++ ) field[i].checked = true ; } /script input type=checkbox name=email[] value=5 input type=checkbox name=email[] value=2 input type=checkbox name=email[] value=1 input type=button value=test onclick=func( document.forms[ 0 ].elements[ 'email[]' ] ) - Original Message - From: Krzysztof Kocjan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 03, 2001 2:47 AM Subject: Re: [PHP] php javascript Try document.myform.elements['email[]'] like below script language=javascript function func( field ) { for ( i = 0; i field.length; i++ ) field[i].checked = true ; } /script form name=myform input type=checkbox name=email[] value=email_1 input type=checkbox name=email[] value=email_2 input type=checkbox name=email[] value=email_3 input type=checkbox name=email[] value=email_4 input type=checkbox name=email[] value=email_5 br input type=button value=test onclick=func( document.forms[ 0 ].elements[ 'email[]' ] ) /form Krzysztof [EMAIL PROTECTED] wrote: Hey all! I'm including some javascript that enables a button in a form input type=button name=CheckAll value=Check All onClick=checkAll(document.myform.email)to check all the check boxes at once. (I have an array of check boxes from a mysql db) I use: SCRIPT LANGUAGE=JavaScript !-- Begin function checkAll(field) { for (i = 0; i field.length; i++) field[i].checked = true ; } function uncheckAll(field) { for (i = 0; i field.length; i++) field[i].checked = false ; } // End -- /script So... In order to use this script my button has to have onClick=checkAll(document.myform.email) and my check boxes have to have name=email but i need to name them name=email[] in order to pass the variables as an array in php. ive tried using onClick=checkAll(document.myform.email[]) but that just gives me an error for obvious reasons im sure. I don't know jack about javascript, so if you know of a better way to make a button that selects all check boxes or another way to code how the check boxes values are passed to the next page, I would be so greatful. Thanks! Nate 99% trafien. 1% rezerwy, zeby innym nie bylo przykro. Nowe Centrum Wyszukiwania http://szukaj.interia.pl/ -- 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 javascript
Thanks... Leave the input name as email. If you really want to call it email[], you should be able to reference this in JavaScript as the object document.myform[email[]] document.myform[email[]] seems to give me a syntax error. If you leave it as email, you can then convert the email variable into an array using explode() or split() as so: On the recieving page I have echo($array = implode (,, $email)); which echos the array of text box values just fine. but only if the input name=email[] not name=email, and email[] doesnt work since my javascript uses email, not email[] - Original Message - From: Matthew Armsby [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 03, 2001 2:54 AM Subject: Re: [PHP] php javascript Leave the input name as email. If you really want to call it email[], you should be able to reference this in JavaScript as the object document.myform[email[]] If you leave it as email, you can then convert the email variable into an array using explode() or split() as so: ?php // on the recieving page, of course $emailArray = explode (,, $email); // Alternatively, a bit of RE exploding... $emailArray = split (,, $email); ? Matt Hey all! I'm including some javascript that enables a button in a form input type=button name=CheckAll value=Check All onClick=checkAll(document.myform.email)to check all the check boxes at once. (I have an array of check boxes from a mysql db) I use: SCRIPT LANGUAGE=JavaScript !-- Begin function checkAll(field) { for (i = 0; i field.length; i++) field[i].checked = true ; } function uncheckAll(field) { for (i = 0; i field.length; i++) field[i].checked = false ; } // End -- /script So... In order to use this script my button has to have onClick=checkAll(document.myform.email) and my check boxes have to have name=email but i need to name them name=email[] in order to pass the variables as an array in php. ive tried using onClick=checkAll(document.myform.email[]) but that just gives me an error for obvious reasons im sure. I don't know jack about javascript, so if you know of a better way to make a button that selects all check boxes or another way to code how the check boxes values are passed to the next page, I would be so greatful. Thanks! Nate -- 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 javascript
document.myform[email[]] seems to give me a syntax error. Check if your already using you'll need to use single quotes as so: input type=button name=CheckAll value=Check All onClick=checkAll(document.myform['email[]']) (tested on IE 5.5 and NS 4.08, works) If you leave it as email, you can then convert the email variable into an array using explode() or split() as so: On the recieving page I have echo($array = implode (,, $email)); which echos the array of text box values just fine. but only if the input name=email[] not name=email, and email[] doesnt work since my javascript uses email, not email[] If you want to continue using email[], the above advise should be okay, and no need to read on. If you want to use email, instead of echo(implode(,, $email)), just echo($email), then you can use explode() when you want the array. ?php // When using $email, not $email[] // The comma seperated string: echo($email); // The array: $ar_email = explode(, $email); // The array glued for viewing: echo(implode (,, $ar_email)); ? -- 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] PHP + javascript
Hi - I want to use javascript to validate some fields on a form. The javascript code will take the value the user typed into the form and search for it in an array. If the value is found in the array, then the value is ok, otherwise an alert() message will be displayed. The amount of data in the array is quite large. The data in the array rarely changes. I want to avoid transferring the array from the web server to the client's web browser every time the user loads the form. I put the array in a file called myarray.js: $ cat myarray.js var MyArray = new Array( value 1, value 2, many lines snipped value 789, value 790 ); $ Then, I put the following line in the php script that generates the form: script language=JavaScript src=myarray.js/script By examining Apache's access_log, I see that myarray.js is transferred to the user's web browser once when the form is first displayed, and for subsequent uses of the form, the web browser uses the myarray.js that is cached, so that the array does not have to be transferred from the web server to the client computer every time the user uses the form. So, if the data in the array contained in myarray.js _does_ need to be changed, I need some way of signaling the user's web browser that it needs to transfer the updated myarray.js file from the web server. How do I do this? The only way I know to do this is to instruct the users to clear their web browser cache, which will force the web browser to transfer the updated myarray.js from the web server to the web browser. Is there another way? Is there some kind of expire mechanism that will tell the web browser that it needs to get the updated myarray.js file? Thanks - Jim Ide -- 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 + javascript
This is usually handled by the browser automatically. (Nobody likes to see out of date content when browsing the web). Users can set their browser settings to check for new things once per session, every time, or never (or some variation of these). Most users use once per session. Otherwise, a complete reload can be forced on many browsers (NS and IE at least) by holding shift and clicking reload. Joseph -Original Message- From: Ide, Jim [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 01, 2001 4:36 PM To: '[EMAIL PROTECTED]' Subject: [PHP] PHP + javascript Hi - I want to use javascript to validate some fields on a form. The javascript code will take the value the user typed into the form and search for it in an array. If the value is found in the array, then the value is ok, otherwise an alert() message will be displayed. The amount of data in the array is quite large. The data in the array rarely changes. I want to avoid transferring the array from the web server to the client's web browser every time the user loads the form. I put the array in a file called myarray.js: $ cat myarray.js var MyArray = new Array( value 1, value 2, many lines snipped value 789, value 790 ); $ Then, I put the following line in the php script that generates the form: script language=JavaScript src=myarray.js/script By examining Apache's access_log, I see that myarray.js is transferred to the user's web browser once when the form is first displayed, and for subsequent uses of the form, the web browser uses the myarray.js that is cached, so that the array does not have to be transferred from the web server to the client computer every time the user uses the form. So, if the data in the array contained in myarray.js _does_ need to be changed, I need some way of signaling the user's web browser that it needs to transfer the updated myarray.js file from the web server. How do I do this? The only way I know to do this is to instruct the users to clear their web browser cache, which will force the web browser to transfer the updated myarray.js from the web server to the web browser. Is there another way? Is there some kind of expire mechanism that will tell the web browser that it needs to get the updated myarray.js file? Thanks - Jim Ide -- 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]