# dynamic php pages



## InkedApparel (Mar 18, 2009)

OK,

I'm beginning to build my store website and would like to add a function that would dynamically create a page with a form and image on it from a link on another page that a user clicks on...I would like to do it with php if this is possible.

say I have a store with 20 images of shirts I have for sale..these are thumbnails , the user wants to see a bigger preview so he/she clicks on the thumb...once the user clicks on the thumb , this would dynamically create another page with the image and a form with size - color - quantity...ect.

is this even possible with php?

any help would be greatly appreciated

Inked


----------



## InkedApparel (Mar 18, 2009)

WOW!

80 views and not 1 reply.....I guess this isnt possible....

Inked


----------



## Weiskamp (Jun 14, 2011)

This is possible, I would create a database of the products in mySQL for ease of updating. You can then set a hidden field in the form (presumably your thumbnail) to the primary key and when it is clicked, have it run the PHP function that calls that line from the database and creates the form. When you submit this form, be sure that the user input is passed to session variables so you can calculate cost.

If you are more familiar with XML, this would work with XML instead of a database as well.


That being said. This *can* be done using just session variables instead of a database or XML. You would need to hard code all of the variables though. It's possible, but clunky and a real pain if you ever have to update anything. 

Hope that at least gives you a direction to go in.


----------



## MUK (Dec 2, 2010)

InkedApparel said:


> OK,
> 
> I'm beginning to build my store website and would like to add a function that would dynamically create a page with a form and image on it from a link on another page that a user clicks on...I would like to do it with php if this is possible.
> 
> ...



Yes this is possible,

You would create a page for your 20 thumbnails (products.php) and you could then create a page for the individual products (ind_products.php) each thumbnail could be linked in the database to an ID and then you could pull all the other information on the ind_products.php page.

For example;
ind_products.php?id=7072343 would bring up all the information (including the thumbnail) for the product which has the 7072343 id in the database. Make sure if you create this you think about errors, for example if a product id doesn't exist there needs to be an else part to the PHP statement.

If you PM me i can help you further and possibly help you create this.


----------



## starchild (Jul 22, 2009)

If you have to ask that question start here: 
PHP with MySQL Essential Training

This is not a question that can be answered without you understanding what needs to be done.


----------



## CGoal (Aug 2, 2011)

Technically it can be done.
I am not much of a inker at this stage and just joined these forums not too long ago.

But your requirements sound similiar to something that i did for a local sports team webpage.

it is a soccer team. and you can go to a ROSTER page to look up the players on the team. And each player you can click on to see their profile.

the concept is the same.

i did this in MySQL database and PHP

You can load the products into a database
Create the page that displays all the products
Then create the 1 template page that will display whatever thumbnail will get selected

To see what i did >> Saint Benedict's Soccer

I can send you the source code if you think that will get you started.


----------



## DonR (May 6, 2011)

What your looking for is not really a dynamic page. A dynamic page would use Ajax along with php to change the content of the page with the thumbnails. For instance, you could have the thumbnails on the left of the page and a detail zoom view on the right. As a user hovers over a thumbnail, the detail zoom area would change.

The easy way to accomplish what you want is to create the page with the thumbnails with links to 20 static pages. Nothing fancy but it will work! If you have access to the html, it is just as easy to make changes to the page as it would be to update a MySQL file. Start to create your pages dynamically when you have alot (100 Plus) pages to maintain.

Print Promowear, LLC


----------

