Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8831243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:15:59+00:00 2026-06-14T08:15:59+00:00

I have created a php site, and previously it was listing only products with

  • 0

I have created a php site, and previously it was listing only products with defined values. I have now changed it to include an array of products for example all products WHERE id = “spotlights”

and this works great so it means I can add new products just to the database, but I still have to add the second page manually. e.g going from the product div on the main page, through to http://www.example.com/spotlight_1.php

Is there anyway in PHP to carry the data from my index.php e.g. the ID through to the next page? so that I can have a template product.php page, and I can use a database pull to echo the product information required.

So on index.php i click on the product with ID=”1″ and on the product.php page, it loads the relevant data for product 1.

I can write the php SQL/mySQL calls myself, its just the way to carry accross a value from the previous page which I dont understand

Regards

Henry

p.s.
all the IDs and things are stored in the database already as 1 to 3digit values e.g. 3 or or 93 or 254

Any advice as always is greatly appreciated

Regards

Henry

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:16:00+00:00Added an answer on June 14, 2026 at 8:16 am

    im not sure if im understading this correctly but you can pass the variable from one page to another using GET variables, or in other words, using the query string in the URL.

    So, in index.php you will have links like this:

    <a href="product.php?p=1">Product 1</a>
    

    In the second page (product.php) you can get this variable using this code:

    $product_id = $_GET['p'];
    

    And then query your database like this:

    $query  = "SELECT * FROM products WHERE id = '" . $product_id . "'";
    $result = mysql_query($query);
    

    Reference: http://www.w3schools.com/php/php_get.asp

    Note: Be careful with the way you query your database, the previous code is only a demonstration of how to retrieve the info, but is not a secure solution. I recommend you to check PDO (http://php.net/manual/es/book.pdo.php).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a site twoo years ago in php and now converting it
I have created a simple PHP web site with two areas - a public
So I created this little login system for my php site, I have a
I have created a config.php file for my site. it seems to be working
I have created a management page for my php site. I have a management
I'm new to php and I have created a simple site using php5. my
I have created PHP GD image for captcha, file called image.php each time it
I am noob with php so pardon my ignorance. I have created php form
I have created a php/mysql based chat page.It is like gmail chat.once i click
I have created a PHP script and I am lacking to extract the primary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.