You are here: Re: DOM doc - simple find element PHP+JS « PHP Programming Language « IT news, forums, messages
Re: DOM doc - simple find element PHP+JS

Posted by one man army on 01/19/06 08:46

In article <1137652071.489010.277050@f14g2000cwb.googlegroups.com>,
"Tony" <tony23@dslextreme.com> wrote:

>...
>
> > I need PHP to do the SQL query. The PHP SQL query is all set up, it
> > works. I need to read the value from the INPUT to add to the SQL query.
> > I have the value in javascript. How can I pass that single bit of data?
> > perhaps I need to pass the var FROM javascript TO the PHP code block. Or
> > else read the DOM element in the PHP as I originally asked.
>
>...
> That said, I'll take a wild stab at an uninformed guess:
>
> document.getElementById('zipRaw_id').value = theValueIWantToSetItTo;
> - that is - set the value of the <input>...
>

hmmm, that is the Javascript part. Perhaps I will expand on this..

* I have a very simple HTML page, with a FORM, with an INPUT TEXT
* there is a button that activates some javascript
* the javascript causes this to happen

// Create new JS element
var jsel = document.createElement('SCRIPT');
jsel.type = 'text/javascript';
jsel.src = url;

// Append JS element (therefore executing the the PHP call)
document.body.appendChild (jsel);

url points to a PHP file! the appendChild has the effect of causing the
script to be executed. Apparently the broswer thinks it is Javascript,
so the javascript in it runs, but the suffix is .php, so the server sees
it , and the PHP runs. Really, it works.

The reason I did this is to run a MySQL query from PHP, based on a
dynamic input value. But here is where I got stuck.. I can read the DOM
element in javascript. I need the value in the PHP block. I thouht I
would just try the DOM calls in PHP, but they read an HTML file, or else
read 'html', but I don't know how to point the php call at the _workin_
page; or alternatively, read the element in JS and pass it in SOMEHOW to
the pHP code block.

Questions and clarifications gladly made, I really want to make this
work. thanks in advance

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация