Jump to content

[SOLVED] Very Simple Variable Help Needed!


Warptweet

Recommended Posts

Hi there.
This may seem confusing, but this is really just variables.
I have a form....
This is what it has.

Browse Files (Uploader part, I already got this covered)
Flash Name:
Flash Author:
Flash Description:

And their names are...

uploadedfile (dont worry, I got the uploader part covered)
flashname
flashauthor
flashdescription

When you submit the form, it goes to upload.php.
At my upload.php, how can I call the content submitted?

Would I use....

uploadedfile (dont worry, I got the uploader part covered)
$flashname
$flashauthor
$flashdescription

I'm not exactly sure how I would call or use the text typed inside the forms, can anyone help? Oh, and just in case you were wondering, I'm creating a PHP file in the script with these variables in them.
Although, I have some problems with this also, which too have to do with simple variable problems.

$ourFileName = "testFile.txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fclose($ourFileHandle);

Okay, so, for the first line.
$ourFileName = "testfile.txt";
How can I make it so that "testfile.txt" is actually the name of the flash file that has been submitted? (For instance, in the "browse file" part of the form, I upload flash.swf, I need $ourFileName = the .swf flash file I uploaded)

Second line
$ourFileHandle = fopen($ourFileName, 'w') or die ("can't open file")
I need it to write all three things submitted in the forms

Flash Name
Flash Author
Flash Description

Thanks! It's simply confusing how I get what is submitted in form text boxes into variables on the submitted page. I appreciate any help, thanks a million in advance!
Link to comment
https://forums.phpfreaks.com/topic/32811-solved-very-simple-variable-help-needed/
Share on other sites

I would say skip the middle man and just make

[code]
$ourFileName=$_POST['flashname'];
[/code]

While your learning anyway, but you want to look into verifying what the user has submitted to you. A rule of thumb I have heard many times in my short PHP career,... Don't trust any raw data from users, always make sure it is what your expecting be it alpha-numeric, email, or whatnot.

check out this article

[url=http://andreas.id.au/blog/archives/101-Never-trust-user-data!-How-to-validate-user-input.html]
http://andreas.id.au/blog/archives/101-Never-trust-user-data!-How-to-validate-user-input.html
[/url]

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.