Warptweet Posted January 4, 2007 Share Posted January 4, 2007 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)flashnameflashauthorflashdescriptionWhen 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$flashdescriptionI'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 formsFlash NameFlash AuthorFlash DescriptionThanks! 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! Quote Link to comment Share on other sites More sharing options...
fert Posted January 4, 2007 Share Posted January 4, 2007 it depends on what the form method is Quote Link to comment Share on other sites More sharing options...
Warptweet Posted January 4, 2007 Author Share Posted January 4, 2007 It's using the "submit" method, is that what you mean? And it leads to upload.php Quote Link to comment Share on other sites More sharing options...
chronister Posted January 4, 2007 Share Posted January 4, 2007 the only 2 methods for a form to submit is POST and GETif it's POST, then you use $var_name=$_POST['fieldname'];if it's GET then$var_name=$_GET['fieldname']; Quote Link to comment Share on other sites More sharing options...
Warptweet Posted January 4, 2007 Author Share Posted January 4, 2007 I found out it's POST.So...Thats mean I would do this...?$flash=$_POST['flashname']If so... sweet! Thanks!Today is the first day I actually started "learning" PHP.I think I'm getting the hang of it! Quote Link to comment Share on other sites More sharing options...
chronister Posted January 4, 2007 Share Posted January 4, 2007 $flash=$_POST['flashname'];make sure you don't forget the semicolon as that will wreak havoc on your scripts. Quote Link to comment Share on other sites More sharing options...
Warptweet Posted January 4, 2007 Author Share Posted January 4, 2007 Oh, lol!ONE MORE THING!!!$ourFileName = "testFile.txt";Thats line of code. Can I do this...?$ourFileName = $_POST['flashname'];OR can I do this? (after doing $flashname = $_POST['flashname'];)$ourFileName = $flashname Quote Link to comment Share on other sites More sharing options...
chronister Posted January 4, 2007 Share Posted January 4, 2007 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] Quote Link to comment Share on other sites More sharing options...
Warptweet Posted January 4, 2007 Author Share Posted January 4, 2007 Thanks so much! This means so much to me!!!!I was actually wondering how to make sure the users actually put in some data... it will be usefull! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.