W3C home > Mailing lists > Public > www-html@w3.org > July 2005

RE: PHP and HTML, and how to access PHP variables from HTML

From: Rajib Momen <elrond@bostoncomputing.net>
Date: Sun, 17 Jul 2005 13:05:50 -0400
To: "'jim sullivan'" <jim-sullivan@comcast.net>, <www-html@w3.org>
Message-ID: <E1DuCaO-0005Jj-Tq@lisa.w3.org>
Try something like this:

 

<?php

foreach(glob("*.jpg") as $imagefile)

{ 

   echo "<img src=$imagefile title='$imagefile'>";

}

?>

 

The variable references must be within the areas that PHP is able to parse.
PHP is entirely server-side, the client's browser has no idea what
$imagefile is. It just thinks it is text.

 

Best regards,
Rajib Momen

President, Director of I.T.
Boston Computing Network
http://www.bostoncomputing.net 

  _____  

From: www-html-request@w3.org [mailto:www-html-request@w3.org] On Behalf Of
jim sullivan
Sent: Friday, July 15, 2005 3:19 PM
To: www-html@w3.org
Subject: PHP and HTML, and how to access PHP variables from HTML

 

 

This is a general question on how to reference script variables from HTML, 

although the example I use is with PHP.  Can someone point me to an example 

that shows how to do this ?  

 

I want to use the PHP file system functions to read the contents(image
files) of a directory, 

and then reference the PHP variable from HTML to display the image. 

Here is an example that does NOT work but it should show what I am trying to
do. 

 

<?php

foreach(glob("*.jpg") as $imagefile)

{ 

?> 

<img src=$imagefile title="$imagefile"> 

<?php

}

?>

 

 

thanks

 
Received on Sunday, 17 July 2005 17:05:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:03 GMT