»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 02-05-2004, 09:38 AM   #1 (permalink)
Registered User
 
Join Date: Dec 2002
Posts: 36
dragonz is on a distinguished road
Tricky question - PHP form help

I'm trying to set this up so that it does 2 things when someone hits submit.

I want the normal function to happen (whatever upload.php does)

But I also want to add some extra input boxes that will send the entered text to a .txt file at the same time.

For example.. I want to add an input box for someone to enter their e-mail address, and one to enter their nickname as well. But while the input boxes that are already there do what they are supposed to do, I want the e-mail input data and the nickname to be sent to the .txt file.

I don't know if I need to make a separate form for that, or if I can add it all into the same form.. Can anyone help me out with this?

This is the code for the form that I have now, without the new input boxes that I want to add.

Code:
<form enctype="multipart/form-data" action="upload.php" method="post">
Upload a file<br />
<input type="file" name="tfile" /><br />
Associate a password<br />
<input type="password" name="password" /><br />
Referer's name here.<br />
<input type="text" name="referer" size="50" /><br />
<input type="submit" value="Upload" />
</form>

dragonz is offline   Reply With Quote
Old 02-06-2004, 08:57 AM   #2 (permalink)
Registered User
 
eagle1's Avatar
 
Join Date: Oct 2001
Location: La Isla del Encanto
Posts: 4,125
eagle1 is on a distinguished road
CAn't you do that from the same functions in upload.php?
I think you can!
For example, to get the information from the textboxes you can just use the $_POST="name of the form bla bla blah" (if you are using post ).
And then you can apply something like this:

http://us4.php.net/manual/en/function.fwrite.php


__________________
boo!

Last edited by eagle1; 02-06-2004 at 09:05 AM.
eagle1 is offline   Reply With Quote
Old 02-07-2004, 04:00 PM   #3 (permalink)
Registered User
 
shampoo's Avatar
 
Join Date: May 2002
Posts: 227
shampoo is on a distinguished road
Edit: ahhh scratch that

Last edited by shampoo; 02-07-2004 at 04:03 PM.
shampoo is offline   Reply With Quote
Old 02-07-2004, 04:34 PM   #4 (permalink)
Registered User
 
krohnjw's Avatar
 
Join Date: Oct 2001
Location: ~/
Posts: 2,567
krohnjw is on a distinguished road
Send a message via AIM to krohnjw
Yeah, just put them into the form and edit upload.php.

You can access the values using $_POST[varname] and do whatever you want with them, that includes writing to a file.

If you are going to do this a lot though might i suggest setting up a database?
krohnjw is offline   Reply With Quote
Old 02-07-2004, 04:57 PM   #5 (permalink)
Registered User
 
Carl-cox-'s Avatar
 
Join Date: Nov 2002
Location: Kent England
Posts: 235
Carl-cox- is on a distinguished road
yeh basically what krognjw is saying for example
Code:
$filename = 'test.txt';
$linetoadd = $HTTP_POST_VARS['username']."*|*".md5($HTTP_POST_VARS['password'])."*|*".$date()."\n";
$handle = fopen($filename, 'a');
fwrite($handle, $linetoadd);
fclose($handle);
should do the trick

also user $HTTP_POST_VAR instead of $_POST

becasue older versions of php can't handle the $_POST
Carl-cox- is offline   Reply With Quote
Old 02-07-2004, 08:51 PM   #6 (permalink)
Registered User
 
eagle1's Avatar
 
Join Date: Oct 2001
Location: La Isla del Encanto
Posts: 4,125
eagle1 is on a distinguished road
WOW!!
I'm surprised that I wasn't that far off!!!!

(I don't know much PHP at all!! :P ).
__________________
boo!
eagle1 is offline   Reply With Quote
Old 02-08-2004, 01:04 PM   #7 (permalink)
Registered User
 
Join Date: Jul 2003
Location: Kingwood, TX
Posts: 935
Rand Dusing is on a distinguished road
Send a message via AIM to Rand Dusing
Hotscripts.com has some good PHP scripts that you maybe able to to use or help you make your own.
Rand Dusing is offline   Reply With Quote
Old 02-10-2004, 07:12 AM   #8 (permalink)
Registered User
 
Join Date: Dec 2002
Posts: 36
dragonz is on a distinguished road
Thanks everyone.
dragonz is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 03:53 PM.