从不同的< div>提交表单HTML [英] Submitting form from different <div> HTML

查看:96
本文介绍了从不同的< div>提交表单HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用2个不同的div(标签)提交表单时遇到问题。我想提交这个表单的所有值..但是当我提交时,我只接收到的值(div class =tab1)而不是div class =tab2。我怎样才能提交所有的价值,即使使用不同的div

i have problem with submitting a form using 2 defferent div(tabs). I want to submit all the value from this form.. but when i submit, the value that i receive only from (div class="tab1") not from div class="tab2". how can i submit all the value even using different div

page.php

<div class="tab1">
<h2>Basic Information</h2>
<form name="pages_details" method="post" action="pages/save_pages.php">
<table>  
    <tr>  
        <td>Name:</td>  
        <td><input name="name" type="text" ></input></td>  
    </tr>  
    <tr>  
        <td>Order:</td>  
        <td><input name="ord" type="text"></input></td>  
    </tr> 
</table>
</div>
<div class="tab2">
<h2>Additional Information</h2>
<table>  
 <tr>  
    <td>Special:</td>  
    <td><input name="special" type="text" ></input></td>  
 </tr> 
 <tr>  
    <td>Title:</td>  
    <td><input name="title" type="text"></input></td>  
 </tr> 
</table>
</div>
<input type="submit" name="save" value="save">
</form>

save_pages.php

save_pages.php

<?php
$name = $_REQUEST['name'];
$ord = $_REQUEST['ord'];
$special = $_REQUEST['special'];
$title = $_REQUEST['title'];

echo $name;
echo $ord;
echo $special;
echo $title;
?>


推荐答案

尽量确保以正确的顺序关闭标签。
这样构造代码可能会导致一些奇怪的错误。

Try to make sure you close tags in the right order. Structuring code like this can cause some weird bugs.

不正确:

Not right:

<div>
<form>    
</div>
</form>

所以你可能想这样做。

<form>
<div>
</div>
</form>

这篇关于从不同的&lt; div&gt;提交表单HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆