Jump to content

changing the content of the page by the link thats clicked


nook6

Recommended Posts

Hi

This may be a bit difficult to understand but i will try to explain it as best as i can.

I am making my first php website and i have a header and footer page the links are in the header.
i have my index page which just pulls external files (header.php mainpage.php and footer.php) what i want to know is if someone clicks one of the links at the top of the page can i change the mainpage.php to the page they want to look at so im using the one page just to pull in other external pages on my website?.

I hope someone can understand what im talking about but if you have any problems just ask for the information you need and i will answer.

Nook6

Thanks in advance.
Link to comment
Share on other sites

Hi

yes im looking to have one page (index.php) that just calls the other parts (e.g. header and footer called at the top and bottom) then it calls whatever page by what link the person clicks so if the person clicks home page it calls index page and puts page one info into it if they call page 2 then it clls index.php and it puts page2.php info onto the page. 
the only other thing i can say is in html i used to do this with an iframe to load the pages and then i hade the links header and footer all staying the same and just the iframe changing the pages?

i hope that helps a little more.

Nook6
Link to comment
Share on other sites

Okay well if you have all the links on the header.php
Why not make your header the main page (index.php), so it will have all its info and include home.php and footer.php on that page. Then you can give your link a name lets say Page2 and set it as a form with action='' and method='post'. al you do from there is tel the system what to do.

if (isset($_POST['page2'])){include('page2.php');}
elseif (isset($_POST['page3'])){include('page3.php');}
and so on and then just to make you home page as default
else {include('home.php');}
Link to comment
Share on other sites

Hi

Im sorry im still having problems with this i know it is now my coding so here is the page with the coding on.

This is index.php

[code]
<html>
<head>
</head>
<body bgcolor=black text=yellow>
<center><img src=images/banner.jpg><br><br>
<a href=index.php><img src=images/home.jpg border=0></a>
&nbsp;&nbsp;
<a href=games.php><img src=images/games.jpg border=0></a>
&nbsp;&nbsp;
<a href=wip.php><img src=images/wip.jpg border=0></a>
</center>

<?
if (isset($_POST['games'])){include('games.php');}
elseif (isset($_POST['wip'])){include('wip.php');}
else {include('index.php');}
?>

<? include('footer.php'); ?>

</body>
</html>
[/code]


This is the url to the page just in case you want to see whats happening
[url=http://daves.servegame.com/website/]http://daves.servegame.com/website/[/url]

This is just a simple page i put together to test this on so it isnt looking very good lol.

Any help would be appreciated
thank you

Nook6
Link to comment
Share on other sites

Okay wait, Your not using the include as you sould here.

create your images into a button of a folder like your games image into a form.

<form action"" name="games" methop="post"><input type="submit" name="games" value="<img src=images/games.jpg border=0>"></form>

Then is should work fine.
Okay not sure if that image in there will work, I'm not an webdeveloper only do PHP and MySQL for now.
Brother do the designing and stuff.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.