Forum Moderators: coopster

Message Too Old, No Replies

javascript and php?

         

electricocean

1:53 am on Mar 15, 2005 (gmt 0)

10+ Year Member



can I have a javascript file calling up different inculde() files's in the same place, and have one load when the page is loded?

would the code something like this?:

<div id="main">
<script language="javascript">
function newpage(inc){
document.write("<?php include(' + inc + ')?>")
}</script>
</div>

electricocean

ironik

2:52 am on Mar 15, 2005 (gmt 0)

10+ Year Member



PHP only parses the page once, so anything you pass to the newpage function won't work. What you'll have to do (although this wouldn't be a good practice) is to store the data from PHP on the page load, then process it with javascript afterwards.

From your function there I can see what you are trying to do, but unfortunately it's beyond the ability of PHP. Perhaps you could put something in a frame/iframe if you needed portions of your page to change.