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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.