A JM Posted May 12, 2009 Share Posted May 12, 2009 I've been running in test a form that will allow me to upload file paths to my DB and have that fully functional. I also have a form that I use to submit records to my DB and it also is working fine. Here's my problem, I want to combine the two together and am confused on how to implement. My form tag for the working DB is: <form action="<?php echo $editFormAction; ?>" method="post" id="form1"> and my form tag for my working file upload is: <form action="upload.php" method="post" enctype="multipart/form-data"> How do I get these to work together- I'm still on a steep learning curve here so go easy on me.. since my upload script lives on upload.php how can I have my DB run both, or am I doing this wrong? :-\ Thanks for any advice and help you can give. A JM, [EDIT] noodling on this here.. should I call the upload.php from $editFormAction portion of the other php script??? Quote Link to comment https://forums.phpfreaks.com/topic/157756-solved-how-to-fix-file-import-and-record-insert-on-the-same-form/ Share on other sites More sharing options...
A JM Posted May 12, 2009 Author Share Posted May 12, 2009 I think I'm getting a clearer picture of why the submit is not working but I still don't know how to solve the problem. I mistyped in my original question - one of my two forms uploads a file to the server and the other enters a record in the DB, I need to merge them together. How do I get a submit to run a SQL query and kick off another php script? The Form action from what I can find will only do one or the other not both so it has to come from within php somewhere... Thanks for any help. A JM, Quote Link to comment https://forums.phpfreaks.com/topic/157756-solved-how-to-fix-file-import-and-record-insert-on-the-same-form/#findComment-832261 Share on other sites More sharing options...
gevans Posted May 12, 2009 Share Posted May 12, 2009 Change your form tag that enters a query to include the enctype="" as that is required for an image upload. Add the image upload input to the form. Then run the image upload script in the same place as the script that enters data to your db. Quote Link to comment https://forums.phpfreaks.com/topic/157756-solved-how-to-fix-file-import-and-record-insert-on-the-same-form/#findComment-832268 Share on other sites More sharing options...
A JM Posted May 12, 2009 Author Share Posted May 12, 2009 Change your form tag that enters a query to include the enctype="" as that is required for an image upload. Add the image upload input to the form. Then run the image upload script in the same place as the script that enters data to your db. Just making sure I understand you. Instead of having a separate file with my script "upload.php" copy it into the DB page and add the enctype="" into the form tag and all should be good? Thanks. A JM, Quote Link to comment https://forums.phpfreaks.com/topic/157756-solved-how-to-fix-file-import-and-record-insert-on-the-same-form/#findComment-832338 Share on other sites More sharing options...
gevans Posted May 12, 2009 Share Posted May 12, 2009 It might not b that straight forward, you may have to tweak somethings, but theoretically yes that's it Quote Link to comment https://forums.phpfreaks.com/topic/157756-solved-how-to-fix-file-import-and-record-insert-on-the-same-form/#findComment-832370 Share on other sites More sharing options...
A JM Posted May 12, 2009 Author Share Posted May 12, 2009 Sorry, I didn't mean to over simplify. Can you tell me a little more about enctype="multipart/form-data"? How will adding this to the form tag and adding the input allow it identify the php script that I want it to run, I was calling the page upload.php directly? I'm just a little confused after thinking about implementation... Would I use something like if( isset($_POST['submit'])) Quote Link to comment https://forums.phpfreaks.com/topic/157756-solved-how-to-fix-file-import-and-record-insert-on-the-same-form/#findComment-832429 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.