view_section.php?section=1 problem

hi I am trying to get my site running but im stuck with a problem…

The code:

 <a href="view_section.php?section=1">Sound</a> 

But how do i tell it to go to a page because I get “OBJECT NOT FOUND!”

Can anyone help if you understand my request

Could you post yoru code foer view_section.php Chris and ill try to help.

do i need a page called view_section or do you mean the page the code is on

Explain to me what your trying to achieve before we go further.

Im here for a while so take your tim e and make sure your concise in your explanation.

Zaid

ok,

I am trying to make a site that does not constantly go from “index.html” to “page2.html” right, so i want when you click on a link to goes to view_section.php?section=1

example: FFiles.com

That is php, you must have a page called “view_section.php” then it is also passing a variable to that php page

Sure I just built a site that does this www.jigsawitsupport.co.uk

You’ll need an index.php file that has the following php code:


if(isset($_GET['section'])){
$section = $_GET['section'];
include($section."html")


}else{
//either some home page info or an error message

}

What you can do then is set your links to <a href=“index.php?section=sounds”>sounds</a> …the PHP script will then look for a document called sounds.html

In the site example ive posted, all the navigation, footer logo etc are within the index.php file. This includes the opening and closing < html > tags, and the content is pulled in to the middle of the site.

Hope this helps?

should i tell you now or later?? it doesnt work :frowning:

http://kirupa.ath.cx/New%20Folder/

post the php.


if(isset($_GET['section'])){
$section = $_GET['section'];
include($section."html");
}else{
//either some home page info or an error message

} 

Without seeing your code my first guess would be the missing semi colon from my code at the end of the linclude line?

thats what i was thinking, this is a syntax error Chris.

Parse error: syntax error, unexpected $end in C:\Program Files\xampp\xampp\xampp\htdocs\New Folder\index.php on line 17

all there is on line even is ?>

Oh sorry if i wasted your time it works now but when it is on the page it has the text of sounds.html which should be there but i also still has the link sounds which i dont want

Dude you need to look up some tutorials on writing PHP code as it appears you’ve never done it before.

Once you’ve grasped the basic concepts, if you’re stilling having trouble come back.

What your tryin to do isnt hard …but it is if you dont know anything about PHP

i know little of PHP not nothing :wink:

dude try posting the actual php source code of the doc …lets see if we can get you rolling on something simple that you can learn from.

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<title>Untitled Document</title>
</head>
<?php

if(isset($_GET['section'])){
$section = $_GET['section'];
include($section.".html");
}else{
//either some home page info or an error message
}
?>

<body>
</body>
</html>

still in progress of making my site

u should be able to create an html doc, with no header/footer info called sounds.html in the same directory as this index file and it will get called into the index file when you use index.php?section=sounds to access the page.