Quick Search:
Oracle PL/SQL Code Library
Find Or Post Oracle Jobs
Oracle Discussion & Chat
 PHP Code: Create an HTML page on demand Jump to:  
Category: >> PHP Code >> Create an HTML page on demand Bookmark and Share

<< lastnext >>

Snippet Name: Create an HTML page on demand

Description: Creating an HTML page on the fly. This could easily be populated from info drawn from a database.

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: March 01st, 2009

//create an html file and redirect to it 
//set some basic html content 
$sHTML_Header = "<html><head><title>Test an html page</title></head><body>"; 
$sHTML_Content = "<h2><center>This is a Test Page</center><h2><br /><hr />"; 
$sHTML_Footer =  "</body></html>"; 
$filename = "test.html"; 
// Let's make sure the file exists and is writable first. 
IF (IS_WRITABLE($filename)) { 
   // In our example we're opening $filename in append mode. 
   // The file pointer is at the bottom of the file hence 
   // that's where $somecontent will go when we fwrite() it. 
   IF (!$handle = FOPEN($filename, 'w')) { 
         ECHO "Cannot open file ($filename)"; 
   // Write $somecontent to our opened file. 
   IF (FWRITE($handle, $sHTML_Header) === FALSE) { 
       ECHO "Cannot write to file ($filename)"; 
      //file is ok so write the other elements to it 
      FWRITE($handle, $sHTML_Content); 
      FWRITE($handle, $sHTML_Footer); 
   ECHO "The file $filename is not writable"; 
//redirect the user to the html page 

Oracle Magazine
and Oracle White Papers

SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 29 users online    © 2009 psoug.org

Forgot your password?