本文介绍了如何将表单放入另一个表单并使用一个提交按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< form action =<?php $ self?>方法= POST >
< h2> LundaBlogg< / h2>
< div class =fname>< label for =name>< p> Namn:< / p>< / label>< input name = textcols =20onkeyup =EnforceMaximumLength(this,12)/>< / div>
< label for =email>< p> Epost:< / p>< / label>< input name =emailtype = textcols =20/>< / div>
< div class =where>< label for =lund>< p>< / p>< / label>< input name =lund type =textcols =20onkeyup =EnforceMaximumLength(this,40)/>< / div>
< p>您可以使用< / p>< textarea name =postrows =5cols =40onkeyup =EnforceMaximumLength(this,110)> < / textarea的>
< / br>
<! - < form action =uploadImage / upload_file.phpmethod =postenctype =multipart / form-data> - >
< label for =file> Ladda upp en bild med dittinlägg:< / label>
< input type =filename =fileid =file/>
<! - < input type =submitname =submitvalue =Submit/> - >
<! - < / form> - >
< / select>< br />
< p>您可以使用我的邮箱:< / p>
< select name =LundaBloggsize =1> <! - Namnet pda dropdown menyn + size = hurmångarader som ska visa。 - >
< option value =Lund> Lund< / option>
< option value =Cyklar> Cyklar< / option>
< option value =Kultur> Kultur< / option>
< / select>
< input name =sendtype =hidden/>
< p>< input type =submitvalue =skicka/>< / p>
< / form>
我希望能够使用一个提交按钮 input type =submitvalue =skicka
我想让我的(代码)
form action =uploadImage / upload_file.phpmethod =postenctype =multipart / form-data
label =fileLadda upp en bild med dittinlägg:/ label
input type =filename =fileid =file
形式
在我的其他表单中,就像上面的示例一样。 你不能。表单不能嵌套在HTML文档中。
您需要将所有数据提交到一个URI中(这是最简单的选项), 或:
- 将第一个表单提交给一个URI
- 返回包含来自该URI的新表单的HTML文档
- have the first form submit to one URI
- return an HTML document containing a new form from that URI
- have the user submit the second form manually after entering data into it
或,使用JavaScript(使用XMLHttpRequest对象)提交表单数据(这是最后一个可靠的选项)。
<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.
解决方案
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:
or, use JavaScript (with the XMLHttpRequest object) to submit your form data (this is the last reliable option).
这篇关于如何将表单放入另一个表单并使用一个提交按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!