I still seem to be missing something.  I guess the easiest thing for me to
do is just show you my code.  All I want is to be able to reference the
$hotspots array from any .html page oon my site.  I thought I could include
hotspot.php and then reference the array using <?= ?> syntax.  What should I
do?  The one requirement is that I cannot make all my pages PHP. They must
be html.

HTML PAGE (test.html):
<title>Untitled Document</title>
<? include("hotspot.php"); ?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


PHP PAGE (hotspot.php):

echo "hotspot = ".$hotspots;

if (!isset $hotspots){
  $connect = connect_to_db();
  $query = "SELECT * FROM hotspots";
  $result = mysql_query($query);
  $count = mysql_numrows($result);

  $hotspots = array();
    $hotspot = mysql_fetch_assoc($result);

"Bogdan Stancescu" <[EMAIL PROTECTED]> wrote in message
> Hi Alexander!
> You're missing the distinction between a server-side script (PHP) and a
> client-side script (JavaScript, VB etc). When you use the syntax you
> used, the browser attempts to download the src and execute it - and it
> can't do that, because in the best case the php code runs on the server
> and returns "test" (your echo()) and then it "tries" to run that as php
> code, which again it doesn't know how. It does work for JavaScript
> however, because it downloads the JavaScript file (which is plain text)
> and then executes the code (because it knows how to execute JavaScript).
> What you should do would be write
> <? include("hotspot.php"); ?>
> instead of "<script language... etc".
> Bogdan
> Alexander Ross wrote:
> > I have a .php file whose purpose, ultimately, is to set one variable;
> > $hotspot.  Now I want to include that var in a bunch of places in my
> > page (it must remain html).  So this was my thought.  In the <head>
> > the following:
> >
> > <script language="php" src="hotspot.php"></script>
> >
> > and then anywhere in the html doc I want to print the value of $hotspot
> > type:
> >
> > <?=$hotspot?>
> >
> > but it doesn't work.  I have a feeling I cant include a php script that
> > because in trying to debug the problem I made the first line of
> > = echo "test"; and the word test never shows.  What am I missing?
> >
> > Thnks
> > Alex
> >
> >
> >
> >

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to