Jump to content

[SOLVED] How to fix file import and record insert on the same form?


Recommended Posts

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???

 

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,

 

 

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.

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,

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']))

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.