0
  <form action="<?php $self ?>" method="post"> 
            <h2>LundaBlogg</h2>
            <div class="fname"><label for="name"><p>Namn:</p></label><input name="name" type="text" cols="20" onkeyup="EnforceMaximumLength(this,12)"/></div>
            <div class="femail"><label for="email"><p>Epost:</p></label><input name="email" type="text" cols="20"/></div>
            <div class="where"><label for="lund"><p>Skriv ditt blogg ämne:</p></label><input name="lund" type="text" cols="20" onkeyup="EnforceMaximumLength(this,40)"/></div>
            <p>Starta tråden med att posta något:</p><textarea name="post" rows="5" cols="40" onkeyup="EnforceMaximumLength(this,110)"></textarea>
            </br>
                <!-- <form action="uploadImage/upload_file.php" method="post" enctype="multipart/form-data"> -->  
                <label for="file">Ladda upp en bild med ditt inlägg:</label>
                <input type="file" name="file" id="file" />
                <!-- <input type="submit" name="submit" value="Submit"/> -->
                <!-- </form> --> 
            </select><br/>
                <p>Välj kategori som du vill lägga din post i:</p>
                <!-- Skapar en dropdown meny med tre värden/value. --> 
                <select name="LundaBlogg" size="1"> <!--  Namnet på dropdown menyn + size = hur många rader som ska visas. -->
                <option value="Lund">Lund</option>
                <option value="Cyklar">Cyklar</option>
                <option value="Kultur">Kultur</option>
            </select>
            <input name="send" type="hidden"/>
            <p><input type="submit" value="skicka"/></p> 
        </form>

I want to be able to use one submit button input type="submit" value="skicka" and I want to have my (code)

form action="uploadImage/upload_file.php" method="post" enctype="multipart/form-data" 
label for="file"Ladda upp en bild med ditt inlägg:/label 
input type="file" name="file" id="file"  

form

inside my other form like the example above.

Toni
  • 97
  • 2
  • 2
  • 7

1 Answers1

2

You cannot. Forms cannot be nested in HTML documents.

You need to either submit all the data to a single URI (this is the simplest option), or:

  1. have the first form submit to one URI
  2. return an HTML document containing a new form from that URI
  3. have the user submit the second form manually after entering data into it

or, use JavaScript (with the XMLHttpRequest object) to submit your form data (this is the last reliable option).

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335