Jump to content

[SOLVED] php code to open a new file with different content (id=15,id=35)


detalab

Recommended Posts

 

Hi guys, I cant sleep because of this. The answer must be pretty easy. But I couldnt figure out HOW!? ::)

 

I have a index.php file and this link below brings up the "project.php" file into the "index.php" via php include function

 

<td colspan="2" valign="top" class="borderTable" onMouseover="this.bgColor='#FFFFFF'"

  onMouseout="this.bgColor=''"> <a href='index.php?type=project'> <b>   Project</b> </td>

 

project.php file brings 4 options (4 different projects)

 

  <td width="420" align="left" valign="middle" bgcolor="#00CCFF"> <a href='project-detail.php?id=15'>   <span class="style7">PROJECT 1</span> </td>

 

 

When I click any of these 4 , I want them to "open"(not include) a new file: project-detail.php, but I want it to have different project content corresponding to the project option.

 

So it will be "/project-detail.php?id=15 for PROJECT 1 and "/project-detail.php?id=35" for PROJECT 2

 

How can I code to open "project-detail.php" file from "project.php" file and make it have different projects content.

 

Here is an exact sample of php code system:

 

FROM http://www.stevenholl.com/project.php?type=educational&page=0 

  TO  http://www.stevenholl.com/project-detail.php?type=educational&id=39&page=0

 

Thank you in advance for your time and wisdom,

 

Best,

 

Matt

Link to comment
Share on other sites

If i follow correctly, you just need to retrieve the variable from the URL using the $_GET superglobal. See here for example.

 

Once you've got that number, you obviously need to load the correct content be it from the a database or by including different files.

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.