Jump to content
xisto Community
Sign in to follow this  
Imtay22

Forms, Text Files, And Php For A Signature Generator. Help a little.

Recommended Posts

Hello everyone! I am in need of some code a for a signature generator I am making. I am using BuffaloHELP's code for the php file, now I am trying to improve that code by making a form in a html file that will have the user say what is on the sig! But now, I need help getting the form data that is posted by the user to get into that sig! There is a file, sig.txt, where that tells the php file what text will go on the sig. But how can I make the form data in the html file go into the text file so it will go onto the sig? You might want to read BuffaloHELP's code. You can find it in probably simalar topics or scroll down some in the php forum. Thanks All!PS. BuffaloHELP's Topic is called dynamic image/ sig generator.

Edited by Imtay22 (see edit history)

Share this post


Link to post
Share on other sites

You need to use the fopen and fwrite functions. That is if I understand you right.

So have the html form submit to a php page that gets all of the vars that the form sent to you and use something like this to modify the text file:

$file=fopen("name of text file.txt", 'w');fwrite($file,"Data to put into the text file");fclose($file);

For the mode (the second paramater of the fopen function), here is a list of what strings do different stuff.

(taken from php.net)

r' Open for reading only; place the file pointer at the beginning of the file.'r+' Open for reading and writing; place the file pointer at the beginning of the file.
'w' Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
'w+' Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
'a' Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
'a+' Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
'x' Create and open for writing only; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. This option is supported in PHP 4.3.2 and later, and only works for local files.
'x+' Create and open for reading and writing; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. This option is supported in PHP 4.3.2 and later, and only works for local files.


I hope this helps!
Edited by alex7h3pr0gr4m3r (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.