snippet is printed not executed

[php]<?php
//upper section of large code
$a = Array(); //Define array $a
$a[“ “]; //1st element is blank

$fh = fopen( //open file that is an array of names whose names have 1 to 6 parts separated by spaces
//save parts of $fh in $a for later use
fclose ($fh?>[/php]

… in a subsequent html form-section of the script, $a is used in an option tag as a selection

[php]<?php //lower section
//$a is used in a form button allowing selection of a name from $a
?>[/php]

This script has worked beautifully for years.

The upper section (1st php code above) was saved verbatim as a file <?php ‘$snippet.php’ ?> and then called as require_once(‘$snippet.php’)
in a new script. Now things are ugly!

Immediately following the require_once() the body of the snippet is displayed verbatim on my monitor and not executed!

What have I done wrong?
USIT again needing help

[php]require_once(‘$snippet.php’)[/php]

this will force a require on a file called$snippet.php
do you have a file with that filename?

Hi, JimL,
Good – Good as usual.
You rung a bell. I checked all file names and found a bad extension.
I went back to the prior version of the main script and am starting again to consolidate some code into a file to be loaded on startup.

Thanks for the quality help that always saves my day
USIT

Sponsor our Newsletter | Privacy Policy | Terms of Service