Chrisj Posted June 13, 2016 Share Posted June 13, 2016 (edited) With a basic image Upload Form, like the one in the script I'm using: <form method="POST" enctype="multipart/form-data" action="upload_avatar.php"> <input type="hidden" name="security_token" value="[var.security_token]" /> <p align="center"><font face="Arial"><input type="file" name="img_file" size="20"></font></p> <p align="center"><font face="Arial"><input type="submit" value="Submit" name="upload"> <input type="reset" value="Reset" name="B2"></font></p> </form> If I add a 'Title' field, 'Description' field/box, and when the fields are populated and the image is chosen (from the pc), and then the 'Submit' button is selected, can the image get processed by one .php file, and the 'Title', 'Description" text get processed by another .php file, from a single 'Submit' button? Is that possible? Edited June 13, 2016 by Chrisj Quote Link to comment Share on other sites More sharing options...
ginerjm Posted June 13, 2016 Share Posted June 13, 2016 Why do you need to do that? Your one script can handle all the inputs for you. If you need to do this thing, set some session vars and do a header to the other script. But - it seems like a needless complication of a very simple process. Quote Link to comment Share on other sites More sharing options...
Chrisj Posted June 13, 2016 Author Share Posted June 13, 2016 Thanks for your reply. So, it is possible. Can you please provide an example of "set some session vars and do a header to the other script"? Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted June 13, 2016 Share Posted June 13, 2016 If you are asking whether or not you can process different parts of the same form using different destination script pages by setting multiple destinations and allocating different form parts to them then yes, you can, but not without implementing some client side script such as javascript. If you have two different script pages designed to process different aspects of the form data and are loath to copy from one to another you can include the other script page in the destination script page and it will "technically" be that different php pages are processing different parts of the form. Although I'm completely with @gingerjm on this one - there is no obvious reason to split this across multiple scripts: it's a single, simple task. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted June 14, 2016 Share Posted June 14, 2016 Again - it makes no sense to separate the handling of this form amongst two scripts unless the form is huge and the bulk of it is already being handled by a previously written script. Chris - as for your request to 'provide an example of "set some session vars and do a header to the other script"?' - uhh, you have the wrong approach to coding, and to the purpose of this forum. What good would it do you to have us write your code? You would learn nothing from that and besides - we're here to help you learn. If you need to ask how to set session vars, you shouldn't be attempting to do what your whole post is asking about. Quote Link to comment Share on other sites More sharing options...
Chrisj Posted June 14, 2016 Author Share Posted June 14, 2016 Asking for an example, helps me learn Quote Link to comment Share on other sites More sharing options...
ginerjm Posted June 14, 2016 Share Posted June 14, 2016 (edited) No. Doing the hard work to read and LEARN something and then applying that helps you to LEARN. If you have a problem during that LEARNing process, the forum will be happy to provide the help you need to get past that LEARNing hurdle. If you want examples then you can google to your heart's content, but reading a manual or finding a beginner's tutorial (cause that is what this is) will get you on the right track. And if you are one of those who uses the excuse that they don't learn well from reading, then you are in the wrong business. Programming is all about reading (and comprehending) manuals. Edited June 14, 2016 by ginerjm 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.