Jump to content

[SOLVED] PHP Simple Display Question


herghost

Recommended Posts

Hi all, I am trying to acheive something in php, that I have tried searching this forum but nut quite sure what to search for!

 

Basically I have an index.php, and using .css this is displayed as a left sidebar and a main content. Basically what I want to do is; when a link is clicked in the left side bar, the main content should show the result. Ie, if the user has added his email address to his profile then when he clicks on say 'email address' on the left, the main contact page will show his email address without loading another page like indexuseremailaddress.php to display it.

 

Would I have to do something like split the sidebar into another php page called something like left.php and call the main content main.php and have them both display from index.php? Wouldnt this leave me with the same problem of having more than one main content page for each detail?

 

 

I hope this is clear enough!

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/146862-solved-php-simple-display-question/
Share on other sites

Hi all, I am trying to acheive something in php, that I have tried searching this forum but nut quite sure what to search for!

 

Basically I have an index.php, and using .css this is displayed as a left sidebar and a main content. Basically what I want to do is; when a link is clicked in the left side bar, the main content should show the result. Ie, if the user has added his email address to his profile then when he clicks on say 'email address' on the left, the main contact page will show his email address without loading another page like indexuseremailaddress.php to display it.

 

Would I have to do something like split the sidebar into another php page called something like left.php and call the main content main.php and have them both display from index.php? Wouldnt this leave me with the same problem of having more than one main content page for each detail?

 

 

I hope this is clear enough!

 

Thanks

 

I think what you're describing will require ajax. 

 

Read their tutorial example....

its easy to get started with this:

http://www.phpfreaks.com/forums/index.php/topic,115581.0.html

 

Basically, what you'll be doing is

when they click a link, the link will point to a javascript function that will make a call to a new page and display the contents of that new page in a div.

 

You'll have the main content in a div or something with an id of say "ajaxBox".  And the javascript function will replace everything in that div with whatever you need.

Thanks for the quick reply :)

 

bugger another language  ;)

 

I shall look into it and see if I can do all I want to do in it.

 

 

 

No, no no....thats what i thought too when the good people here told me I need to use ajax for what I wanted....

 

its nothing new...

its javascript and php working together.....

for some reason they call this process ajax...

 

actually, what it really is is just a new function in javascript....

 

this XMLHttpRequest

it allows javascript to call a page (even a php page) in the background without refreshing the current page (I might be off here, but I think thats what it is)....

 

and then most people use that with an ability that javascript has had for a good while....

the innerHTML

 

the ability to replace anything on the screen with new stuff.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.