You're using the POST method and '' for the action, so put an if statement after your form and do whatever you need to within that if.
Like this:
// form goes here
if (isset($_POST['pick a name from your form'])) {
// do your thing here
}
Voila!
I don't think that will do anything. You need to SELECT more columns than than just the ones you want to JOIN ON to get anything back. Also, I recommend changing imageid to output_images.imageid
Never wrote a do while Loop. So, I looked it up! Looks like it should work Pretty simple concept.. If not post the error, if you can't resolve it and we'll deal with it then.
Great example of the student teaching the teacher, which is frequently the case. Thanks!
Take the results from both queries and do array_push to combine results. Then, do what ever you want in a loop.
https://www.w3schools.com/php/func_array_push.asp
EDIT:
You can also do a UNION if that makes sense.
Let's deal with what might be the first challenge. How you want to do to do your mult queries? Actual separate multiple queries, sub queries, JOINS, etc. If something else needs to happen first, let us know.