swatisonee Posted June 3, 2010 Share Posted June 3, 2010 I have a form that uses php self and includes a dropdown . It also has other variables that a user needs to input. All that datas moves to another php file for processing. Now i also need to be able to upload a file using phuploader.php in the same form. Since phUploader also includes a form, i cannot insert it into the main form without errors coming up. So how do i solve the problem ? The user has to be able to only see one page where he chooses customer , that then leads to addresses getting listed and the user choosing one, then he also adds in other variables - date etc and finally uploads a file and hits a submit button . i can get all of this to work separately but not on a single submit button such that the user sees only one page. ...how may i go about this pl ? thnaks. Field A : Customer –--php self gets activated to give options for Field B Field B: Customer address ---one address selected Field C: Date Field D – other info Field E – Upload a specific file and store it in a folder on the server AND store its path in the table storing data from Fields A-D. The script being used is phUploader.php Submit Link to comment https://forums.phpfreaks.com/topic/203740-whats-an-alternative-to-form-within-a-form/ Share on other sites More sharing options...
phpchamps Posted June 3, 2010 Share Posted June 3, 2010 why dont you include your data field inside the phpuploader's form?? there can be only one form per submit button.. so you will have to modify either phpuploader or you will have to modify your script... Link to comment https://forums.phpfreaks.com/topic/203740-whats-an-alternative-to-form-within-a-form/#findComment-1067085 Share on other sites More sharing options...
beta0x64 Posted June 3, 2010 Share Posted June 3, 2010 You could use AJAX/jQuery to load the file dynamically. There are many file upload scripts available. How about like http://www.uploadify.com/demo/ ? Link to comment https://forums.phpfreaks.com/topic/203740-whats-an-alternative-to-form-within-a-form/#findComment-1067087 Share on other sites More sharing options...
swatisonee Posted June 3, 2010 Author Share Posted June 3, 2010 @beta0x64 : Thanks ! My php skills are rudimentary at best, ajax etc will be beyond me though i will take a look at the link you sent. @phpchamps: i did try to modify but landed up with so many errors at so many places ..if the recycle bin were in the real world , it'd be overflowing ! I even tried the options listed here http://www.webmasterworld.com/html/3985542.htm by giving 2 names to the 2 submits but in vain. Link to comment https://forums.phpfreaks.com/topic/203740-whats-an-alternative-to-form-within-a-form/#findComment-1067091 Share on other sites More sharing options...
phpchamps Posted June 3, 2010 Share Posted June 3, 2010 Swati, why do you want to use phpuploader to upload file.. It's just 5 lines code. Why dont you write it by your own?? you want to upload multiple files??? if yes then how many files??? Link to comment https://forums.phpfreaks.com/topic/203740-whats-an-alternative-to-form-within-a-form/#findComment-1067094 Share on other sites More sharing options...
swatisonee Posted June 3, 2010 Author Share Posted June 3, 2010 not more than 2 files at any time...usually doc, xls , jpg or pdf - but the files can be of diff types ie 1 doc + 1 xls etc Link to comment https://forums.phpfreaks.com/topic/203740-whats-an-alternative-to-form-within-a-form/#findComment-1067107 Share on other sites More sharing options...
phpchamps Posted June 3, 2010 Share Posted June 3, 2010 http://forum.codecall.net/php-tutorials/3952-php-upload-class.html go here use this class.. very simplee.. Link to comment https://forums.phpfreaks.com/topic/203740-whats-an-alternative-to-form-within-a-form/#findComment-1067112 Share on other sites More sharing options...
swatisonee Posted June 4, 2010 Author Share Posted June 4, 2010 @phpchamps: have spent almost 2 days but with no luck on this. this class also requires that i use a form within a form so its the same problem as with phUploader.php. If i dont use the form tags and only use ."<input name='upload' type='file' /> , the file doesnt get uploader nor do i get any error message.. so its back to square 1 :-( .... what can i try now pl ? <?php include("Upload.php"); echo "<form enctype='multipart/form-data' action='index.php' method='POST'>" ."<input name='upload' type='file' /><input type='submit' value='Upload' />" ."</form>"; ......the rest of it. ?> Link to comment https://forums.phpfreaks.com/topic/203740-whats-an-alternative-to-form-within-a-form/#findComment-1067526 Share on other sites More sharing options...
swatisonee Posted June 5, 2010 Author Share Posted June 5, 2010 Can hardly beleive i made such an elementary mistake : <form...> should have been <form enctype= 'multipart/form-data' ...> to allow for file uploads. Link to comment https://forums.phpfreaks.com/topic/203740-whats-an-alternative-to-form-within-a-form/#findComment-1068035 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.