Jump to content

Recommended Posts

Hi there

 

I am stuck on a small php problem  :'( :'( :'( :'( :'(- I would like the address and contact no of the company to be displayed through out the site but controlled via a php file called contact.php - so that if the address or number changes I would only have to change one value in the contact.php file.

 

This is the example of my code

 

<?php

$formAction = '/call-back/';

 

include("contact.php");

 

?>

<div id="mainTop">

    <div id="mainTopLeft">

        <h1>Request A Callback</h1>

        <p>

            If this matter is urgent and you need to speak to an advisor immediately <br />please call <strong><?php echo $franchiseSiteAddress; ?></strong>

        </p>

 

and the contact.php file is

 

<?php

//contact details

 

//Franchise Site

$franchiseSiteAddress = "Suite D";

$franchiseSiteAddress1 = "Wyvern House";

$franchiseSiteAddress2 = "173, Filey Road";

$franchiseSiteAddress3 = "";

$franchiseSiteLocality = "Scarborough";

$franchiseSitePostcode = "North Yorkshire";

$franchiseSiteCountryName = "YO11 3AE";

$franchiseSiteContactNo = "01904 295 555";

 

//make the variables global

 

global $franchiseSiteAddress

global $franchiseSiteAddress1

global $franchiseSiteAddress2

global $franchiseSiteLocality

global $franchiseSitePostcode

global $franchiseSiteCountryName

global $franchiseSiteContactNo

 

?> 

... and the problem is?

 

Edit

 

Noticed this block:

 

global $franchiseSiteAddress
global $franchiseSiteAddress1
global $franchiseSiteAddress2
global $franchiseSiteLocality
global $franchiseSitePostcode
global $franchiseSiteCountryName
global $franchiseSiteContactNo

 

1) You're missing a semi-colon after each declaration

2) Declaring them in the scope you have they're already global

Well as I mentioned before that block of code is superfluous, declaring the variables globally [as you have] makes them global already. Try adding this to the top of your file and check if an error is being triggered:

 

ini_set('display_errors', 1);
error_reporting(E_ALL);

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.