Current location: Hot Scripts Forums » Programming Languages » PHP » php form to html file


php form to html file

Reply
  #1 (permalink)  
Old 01-21-04, 09:35 AM
arnec arnec is offline
New Member
 
Join Date: Jan 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
php form to html file

I have a page which utililizes a form and php to pass variables onto another page. I would like
the latter page to save itself as a static .html file on my server. I am using some code I snagged from
http://dbforums.com/arch/150/2003/5/775940
to do this, but it results in some out-of-control loop that that builds a page that saves itelf, that
builds a page that saves itself, that builds... etc Atleast I think that's what's happening.

Does anybody have any ideas of what I may do.

Hours of frustrating work... I've gone mad.
Reply With Quote
  #2 (permalink)  
Old 01-21-04, 10:14 AM
arnec arnec is offline
New Member
 
Join Date: Jan 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Here's the code I'm using.

This is what I currently have written at the end of my script on the second page.

$root = $_SERVER['PHP_SELF'];
$query = $_SERVER['PATH_INFO'].$_SERVER['QUERY_STRING'];
$wholeurl = "http://"."www.mypage.com"."$root"."?"."$query";

$newfile = "$newfile.html";
$fcontents = "$wholeurl";

$handle = @fopen("$fcontents","r");
$handle2 = @fopen("$newfile", "a");

if (!$handle) {
print ("Sorry - Unable To Open File For Reading.");
die;
}

$contents = fread ($handle, 1000000);

$newval1 = str_replace("form", "", "$contents");

print (" $newval1 ");

fwrite($handle2, $newval1);
fclose($handle);
fclose($handle2);
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP code to edit a text file mdhall Script Requests 12 12-23-10 04:03 AM
PHP in HTML Pages? ZeoFateX PHP 19 01-04-06 06:42 PM
formmail problem gscraper Perl 12 08-27-04 03:06 AM
Write form data to file dragge PHP 1 12-27-03 07:26 PM
how do i re-fill the html form??? gaurav_sting PHP 1 12-21-03 12:13 PM


All times are GMT -5. The time now is 08:37 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.