?
Solved

PHP Div ID Update Div Content

Posted on 2007-07-19
6
Medium Priority
?
3,727 Views
Last Modified: 2012-06-27
OK....This is really doing my head in!!!

Right i have the following

<div id="menu"><a href="Link 2" onClick=document.getElementById('home').href="home.php"
 onmouseover="setOverImg('2','');" onmouseout="setOutImg('2','');" target=""><img src="buttons/button2up.png" border="0" id="button2" vspace="2" hspace="2">
</div>

I have the seperate Div i want to update which is

<div id="home" style="Z-INDEX: 2; POSITION: absolute; TOP: 5px; left: 260px;"><?php include("content.php"); ?></div>

I cannot get this div content to update to show the home.php, please can someone help me put this right as i'm really not understanding why it's not working!

Please can someone tell me how to do an example with the following

Image
Hyperlink
Button

Thanks again
0
Comment
Question by:srfc
5 Comments
 
LVL 15

Expert Comment

by:ncoo
ID: 19527016
Your missmatching css and php.

PHP is run on the server and CSS/Javascript is run on the client (Firefox, IE).

When the following is sent to the user, the server has already run <?php include("content.php"); ?> so you can't change it.

<div id="home" style="Z-INDEX: 2; POSITION: absolute; TOP: 5px; left: 260px;"><?php include("content.php"); ?></div>

You can though do this to change the div.

<div id="menu"><a href="Link 2" onClick=document.getElementById('home').innerHTML="something else in the div"
 onmouseover="setOverImg('2','');" onmouseout="setOutImg('2','');" target=""><img src="buttons/button2up.png" border="0" id="button2" vspace="2" hspace="2">
</div>
0
 

Author Comment

by:srfc
ID: 19533058
i have previously changed it before with the onclick process where it has changed the page to another one i just deleted the code by accident!
i think instead of .innerhtml it was .href"page2.php"; or something
0
 

Author Comment

by:srfc
ID: 19557228
Seeing as no one has replied i worked it out my self and it works a treat
<?php include("Home.php")?> i used this with a link in my menu and the div updates
0
 

Expert Comment

by:lou0999
ID: 21494377
Could you give details as to how you fixed your problem, I can't figure out how to do this either, I've been searching for hours now. Show me some code? PLEASE?
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 21838842
PAQed with points refunded (50)

Computer101
EE Admin
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question