Variable and PHP Include

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Sat May 31, 2014 6:46 am

Variable and PHP Include

Postby SebCollo » Sat May 31, 2014 6:59 am

Hi Everyone,

I have a variable $search in a php file which I use to query an API feed. This file has a form, but by default the variable $search is returning the product I have specified, e.g. $search = "laptop";

Now I want to create a couple of pages with the same template but I want to call a different product for each page. I know that I have to use php include, but how can I override the varibale $search with a different product? I've tried the below, but it's not working.

include 'index.php';
$search = "ipad";

Thanks for your help,

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 10 guests