Jump to content


Photo

changing the content of the page by the link thats clicked


  • Please log in to reply
7 replies to this topic

#1 nook6

nook6
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 10 October 2006 - 10:51 AM

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.

#2 GremlinP1R

GremlinP1R
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts
  • LocationSouth Africa

Posted 10 October 2006 - 11:26 AM

Just to understand somthing here,

Do you want the site to work like frames?
Are you just including you one page on the other?

#3 nook6

nook6
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 10 October 2006 - 11:39 AM

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

#4 GremlinP1R

GremlinP1R
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts
  • LocationSouth Africa

Posted 10 October 2006 - 12:20 PM

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');}

#5 nook6

nook6
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 10 October 2006 - 12:28 PM

Hi

Thanks very much i will try this.

Nook6.

#6 GremlinP1R

GremlinP1R
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts
  • LocationSouth Africa

Posted 10 October 2006 - 12:33 PM

Okay Sharp give a soud If you need some more help!

#7 nook6

nook6
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 10 October 2006 - 05:57 PM

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

<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>


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

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


#8 GremlinP1R

GremlinP1R
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts
  • LocationSouth Africa

Posted 10 October 2006 - 06:27 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users