Jump to content

[SOLVED] Create File On Click..


napalm

Recommended Posts

is there a way to create a file once a button is created?

 

like have a button and when it is clicked it creates a html file into a directory?

 

and possibly have a button when the button is clicked to create it

 

have it so it changes to a remove button and it removes the html file?

Link to comment
https://forums.phpfreaks.com/topic/134443-solved-create-file-on-click/
Share on other sites

No im pretty sure you can do this in php

yeah i know fwrite.. but thats only when u vist the page it creates it

im wondering if theres a way for when u click a link it does it?

 

Yes!  Make a link to a .php page and use the information in the links I gave you.

nono....

 

like:

<form action="" method="post">

  <input type="button" name="create" value="create_file">

</form>

<?php

 

  if (isset($_POST['create'])) {

  $create = "File.html";

  $create = fopen($create, 'w') or die("can't open file");

  fclose($ourFileHandle);

 

  }

 

?>

 

????

This kid is not going to learn anything if you just give him the code.

 

Pipe down, it was a simple example.

 

nono....

 

like:

<form action="" method="post">

  <input type="button" name="create" value="create_file">

</form>

<?php

 

  if (isset($_POST['create'])) {

  $create = "File.html";

  $create = fopen($create, 'w') or die("can't open file");

  fclose($ourFileHandle);

 

  }

 

?>

 

????

 

Is that meant to be a question?

Pipe down, it was a simple example.

 

Sorry, but when someone starts a thread on how to create a file and doesn't even know how to create a submission button, it makes me think he just wants a CnP solution...  And in-case you couldn't figure out the delete part:

 

if (isset($_POST['create'])) 
{
$create = "File.html";
$create = fopen($create, 'w') or die("can't open file");
fclose($ourFileHandle);
}

if (isset($_POST['delete']))
{
$delete = "File.html";
unlink($delete);
}
?>

</pre>
<form action="<?php%20echo%20%24_SERVER%5B'PHP_SELF'%5D;%20?>" method="post">
  
  
<

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.