Adrian Adrian - 5 months ago 8
Javascript Question

Skip file input and use only if is necesary

I have this little form:

<form action="?act=process" method="post" enctype="multipart/form-data">
<input type="file" name="IMG">
<input type="text" name="BG">
<button type="submit">Save</button>

How can I skip the file input if I want to edit only the text input?
I need both because sometimes i need to channge the image.

  • I need to skip the input after POST submit. Only if the input wasn't changed


without seeing your PHP code for "after POST submit" I am guessing that you will simply want to code in a conditional check if the IMG input is empty or not before updating your database.

so it might look something like this:

   // update database