Re: PHP/MSQL/HTML and Javascript
| From: | Jason G. | Date: | Thu, 22 Nov 2001 14:39:10 +0000 |
| Subject: | Re: PHP/MSQL/HTML and Javascript | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-14528@lists.php.net to get a copy of this message | ||
I don't know much about javascript, but I would do the following:
1. Figure out what javascript data structure you are going to use to hold the data.
2. Figure out exactly how it should be coded.
3. Simply write your PHP script to output your javascript as in 2.
The hard part of the matter (which is not very hard) is to figure out how to do the javascript. Create a static page on your local hard drive with hard coded javascript data structures. When you figure out how to do it like that, then add the PHP to generate the page in that format.
By the way, I am going to soon need to do something similar - where the user gives several inputs in a row, and then the data is packed and posted to a php script - which outputs another batch of questions. If you are running a slow connection, or the server is loaded, then having to reload the
page each time you type a word or two could get quite frustrating. So, let me know what you come up with if you have the time.
-Jason Garber
IonZoft.com
At 10:29 AM 11/22/2001 +0100, Dietmar.Friesch@isisconsulting.de wrote:
Hi, out there Has anybody found a way to pass variables between javascript and php? Here's what I want to achieve:1. I want to display a mysql_query result record-by-record(first/prev/next/last buttons) without re-querying.2. I want to use a static html-form and plug the data into <inputname="field_#" type="text" value="">via event triggersonclick="this.form.elements["field#"].value=queryresult_for_field#3. I read the query result into an php-array and want to passarray_values[1-n][1-m] to "query_result_for_field"4. Obviously, I can increase/decrease values of javascriptvariablesObviously, there's a php array and I can set I php-array-counter BUT: I can't achieve to pass either value to the other 5. I know, that php parses html first and then comes javascript,but the array is there and I can use the java-script to place anything into this.form.elements["field#"].value 6, The whole thing is about NOT reload/refresh the page/re-querybut placing values via javascript.objectsand triggers into an otherwise static "forms-fill-in"Has anybody got a clue on that or is it really simply not possible due to 5 above? regards Dietmar