0

I am a student trying to figure out, how i can simultaneously upload an files (jpg, jpeg, png) along with sending an message through PHP?

Currently i have tried two things.

  1. Making a single form in html, and trying to submit to the same .php file. While following two separate tutorials, combining them. (See picture)

  2. Making two different forms, which i want to be submitted from the same html page, with the same ''submit''. Is this possible?

So far i think i figured out that it is not possible to use both $_POST and $_FILES from the same form, is this true?

Any ideas how to fix the original code i already have, and if not, what is the easiest way to do it.

**I am learning, so the easiest way is prefered :) HTML PHP

  • 3
    you can of course send both in the same form . just use post and set enctype="multipart/form-data" in the form tag – Ken Lee Dec 12 '22 at 01:30
  • 1
    `is this true?`...no, not at all. I don't known what examples etc you've been reading. You can do it all from one form. If you're having trouble with that, post a [mre] of the issue and clarify the exact problem. – ADyson Dec 12 '22 at 01:34
  • 2
    `Any ideas how to fix the original code i already have`...not if you don't show it to us!! Please don't post images of code, it's really unhelpful - see [ask]. You can [edit] your post. Thanks. – ADyson Dec 12 '22 at 01:35
  • 1
    P.s. https://stackoverflow.com/a/11040586/5947043 – ADyson Dec 12 '22 at 01:41
  • Thanks Guys, i figured it out. I will also try and follow your comments next time i post a problem here. I was not aware, but i have read How to ask now! – Frederik Groht Mortensen Dec 12 '22 at 21:21

0 Answers0