Jump to content

Create a new file after form submission


ericthomson

Recommended Posts

I am trying to create a very basic "forum"/comments section and I want to know how to have a page be automatically created once the form is submitted.

 

I have found the code:

 

<?php 
function wwwcopy($link,$file) 
{ 
   $fp = @fopen($link,"r"); 
   while(!feof($fp)) 
   { 
       $cont.= fread($fp,1024); 
   } 
   fclose($fp); 

   $fp2 = @fopen($file,"w"); 
   fwrite($fp2,$cont); 
   fclose($fp2); 
} 

//Example on using this function 
//wwwcopy("http://www.domain.com/list.php?member=sample", "sample.html"); 
//Another example 
//wwwcopy("http://www.domain.com/list.php?member=sample2", "sample2.html"); 

?>

 

I am using post for my forum (not even sure how get would handle the comments section). How can I use this (or tweak it)?

 

The variables I am passing are $User, $Email, $Title, $Comments, $Date. Would I still use it the same? ie: wwwcopy("http://www.domain.com/forum/new-post.php?User=$User&Email=$Email&Title=$Title&Comments=$Comments&Date=$Date", "X.php");? Also, the value for X is up in the air. I've considered using the auto increment id(index) number from the mySQL database this is saved in.

Link to comment
https://forums.phpfreaks.com/topic/254375-create-a-new-file-after-form-submission/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.