Unstoppable Domains โ€” Expired Auctions

Form Content PHP Help

SpaceshipSpaceship
Watch

snike

Established Member
Impact
3
I need a script that has a form and when i submit it everything gets saved in a file
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains โ€” AI StorefrontUnstoppable Domains โ€” AI Storefront
Working on it now. I'll post it up soon.

Here's a really basic example.

PHP:
if(empty($_POST['step']))
{
?><form action="?" method="POST">
<input type="text" name="a_field">
<input type="hidden" name="step" value="2">
<input type="submit"></form><?
}
if($_POST['step'] == "2")
{
	$filename = 'data.txt';
	$somecontent = $_POST['a_field']."\n";
	$handle = fopen($filename, 'a+');
	if (fwrite($handle, $somecontent) === FALSE) 
	{
       echo "Cannot write to file ($filename)";
       exit;
   	}
  
   echo "Success, wrote $somecontent to file $filename";
  
   fclose($handle);
}

You can see it in action here:

http://www.ncisolutions.com/projects/misc/form-to-file.php

It works now.
 
Last edited:
0
•••
is it possible to make it write to another file. like

form.php
and
text.php
 
0
•••
Just change this value: $filename = 'data.txt';
 
0
•••
thank you
 
0
•••
You're welcome :)
 
1
•••
Excellent, thanks for the info. I'm slowly learnin' PHP
 
0
•••
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
Appraise.net
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back