Click to See Complete Forum and Search --> : HTML Parsing
phpForum
08-17-2003, 12:46 AM
I would like to use PHP to fetch SQL data, and pass it to JavaScript so that a dynamic table can be created and manipulated. I figure that this is possible through creating a table in HTML with PHP according to the data and then parsing that table with JavaScript. How should I go about doing this?
Would LiveConnection be easier?
zachzach
09-10-2003, 07:20 PM
uhh im still trying to learn php and ive heard of live connection, but only from java to javascript, never from PHP to javascript
probably someone knows an easy way, but until then, try doing this:
make the php script your using go to a dirrerent page and haven the location be like:
www.whateverthenameis.com/whatever.htm?whatever=whatever
and then have javascript get that variable, or if you need to stay on the same page have a iframe load a page that passes the variable, then if you want to do anything else just have the script in the iframe pass the variable to the page ontop
theres an easy way to do that try javascriptsource.com
by the way my new scrren name is pyvo
pyvo, eh? lol... :D
Anyway, since PHP runs server side, it is easy to pass values from PHP to javascript. It is the other way that is a bit harder...
Take this example:
<?PHP
$var = "test";
?>
<script type="text/javascript">
var = <?PHP echo $var; ?>;
alert (var);
</script>The javascript will alert you the value "test" when it is run.
phpForum
09-20-2003, 10:18 AM
Thanks, I can't believe I missed that. Both responses are appreciated.
Khalid Ali
09-20-2003, 10:24 AM
Originally posted by pyro
pyvo, eh? lol... :D
stalker alert...:-)