Welcome to WebHeadStart.org

Web Technologies

Sponsored By

WebHeadStart.org is currently in beta.
Please pardon our appearance as we work to provide you with the most comprehensive reference on today's web technologies.

Interested in advertising on WebHeadStart? Become an advertising partner today!

[WWW-HTML Mailing List Archive Home] [Messages By Thread] [Messages By Date]

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
Valid XHTML 1.0! Valid CSS! Site Map | Privacy Policy | Terms of Use | WebHeadStart.org © 2005 All Rights Reserved.