Creating a PHP variable with Something

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jeff_md66
Forum Newbie
Posts: 1
Joined: Tue Feb 12, 2008 9:37 pm

Creating a PHP variable with Something

Post by jeff_md66 »

I've got a site with several pages on it and I want to yous a table to layout the site as if it were frames. ( I don't want to use frames because they are just to structured)

Ive got a simple site now

a top bar a links bar on the left

a body section in the middle for the actual text

and a bottom bar for a footer

My intention is to create a php (or other) script that will update a php variable based on the link that was click and display the page associated with that link


Lets say I have site1, site2 and site3

I've got

Link1, link2, and link3

When link1 is clicked I want site1 to be displayed in the body section of the site and the rest of the site not to change. the same could be said about site2 and site3

I thought about using javascript onclick but I don't believe I can update the php code with javascript.

<a href="link" onclick="<?php $body['variable']='variable'; ?>">Link</a><br />
<a href="link2" onclick="<?php $body['variable']='variable2'; ?>">Link2</a>


<?PHP Get valriable ?>

Any input would be great
thanks
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Creating a PHP variable with Something

Post by Jonah Bron »

You need ajax. AJAX will allow you to do this, though you will need the ajax to call on php pages.

http://www.google.com/search?sourceid=n ... x+tutorial

Oh, and you'll want a page like this:

Code: Select all

<html>
<head>
</head>
<body>
<table cellspacing="0" cellpadding="0" style="width:100%;height:100%">
<tr>
<td id="button_area">Links</td>
</tr>
<tr>
<td id="content area" style="overflow:scroll;">Main content</td>
</tr>
</table>
</body>
</html>
The overflow:scroll CSS property will make that area scroll
Post Reply