Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Variable and PHP Include

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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.

<?php
include 'index.php';
$search = "ipad";
?>

Thanks for your help,
Seb
SebCollo
New php-forum User
New php-forum User
 
Posts: 1
Joined: Sat May 31, 2014 6:46 am

Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.