View Full Version : PHP + Javascripts
jetalomar
March 18th, 2004, 22:35
Is there a way that I can call a php function or variable with javascripts?
Canuckkev
March 19th, 2004, 01:13
Sigh...
PHP is processed by the server before the page is loaded. Javascript is processed by the client after the page is loaded. So, no there is no way to access PHP directly via javascript.
What is it that you are trying to do?
jetalomar
March 19th, 2004, 09:40
I'm trying to get data from the database and I want to have a drop down menu that when i change the value it will get the data from the database without submiting the form.
kabatak
March 19th, 2004, 10:08
well, here is my idea... you can predefined some variables on 1st load of the php page in javascript like
value1 = <?=$value1?>
value2 = <?=$value1?>
and then make something like
<span id="area_to_change"></span>
in your HTML and then use javascript onchange event in the dropdown to trigger something like
document.getElementById('area_to_change').innerHTML = value1;
that will cause the content inside <span id="area_to_change"></span> to be what the value1 is.
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.