Forum Moderators: coopster
I have a webpage(say index.php) with a sidebar. (A <div>) When i click on a link in the bar, i want to include a php file into the same index.php, in a specific <div> area. So, the page remains, but the content of the div changes depending on the link clicked. I have seen this effect on websites. Is it possible to emulate using php?
What's the concept behind it? I think it will involve a php function with switch statements. Problem is, how do i call this function from a hyperlink (html)?
it will be done through .htacces doc
Find or create an ".htaccess" doc
That will contain:
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
Next to include the PHP script in your html do:
<html>
<head></head>
<body>
<h1>
<?php
include "my_php_script";
?>
</h1>
</body>
</html>
keep in mind that you can call the php script from any level using ../../ etc...
How do i 1) embed the call to php in a href?
2) If 1) works, can i specify where i want the included file to go, mainly in a <div> area on the SAME PAGE.
So u click on links, and on the right of the links, the content changes depending on the link.
All the .htaccess and stuff works. This is the 2nd day i'm doing PHP, so its just inexperience with PHP syntax.
thx.
here is a simple tutorial
but before going in depth I will encorage you to read about the basics of PHP
[developerfusion.com...]
Use query strings in the href, and write the switch statement in the <div> where you want the dynamic data.
*whew*
Sorry for the bother!
So if anybody has a problem placing "included stuff" somewhere on a page there is it. So simple. AARRGGGHHH.
Henry0, i never had a problem configuring the .htaccess or even learning PHP basics. The problem here was, u're clicking on a hyperlink in a <div> say <div A>, and you want to include the stuff, in a TOTALLY different <div> say <div B>, that may be on the opposite side of the page. Fear not, i got it now. Prayer works!