Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
提交表单包含使用php ajax jquery mysql的多个表单_Php_Jquery_Mysql - Fatal编程技术网

提交表单包含使用php ajax jquery mysql的多个表单

提交表单包含使用php ajax jquery mysql的多个表单,php,jquery,mysql,Php,Jquery,Mysql,我是jquery新手,在下面的代码中,当我单击添加新部件时,使用jquery扩展的链接包含来自使用Json的文件的内容。点击提交按钮后,所有值都应该存储在mysql中 Html代码将 <form name="zone_form" method="post" action="product_code.php" onsubmit=""> <input type="hidden" name="frmtype" value="new_product" /> &l

我是jquery新手,在下面的代码中,当我单击添加新部件时,使用jquery扩展的链接包含来自使用Json的文件的内容。点击提交按钮后,所有值都应该存储在mysql中

Html代码将

<form name="zone_form" method="post" action="product_code.php" onsubmit="">
    <input type="hidden"  name="frmtype" value="new_product" />
    <table width="100%" border="0" cellpadding="2" cellspacing="0">
        <tr>
            <td valign="top">Product Name:</td>
            <td><input type="text" name="txt_pro" /></td>
            <td valign="top">Product Quantity:</td>
            <td><input type="text" name="txt_pquan" id="txt_pquan" onblur="tamount(this.value)" /></td>
            <td valign="top">Total Amount</td>
            <td><input type="text" name="txt_pamount" id="txt_pamount" /></td>
        </tr>
        <tr>
        </tr>
        <tr>
            <td colspan="6">&nbsp;</td>
        </tr>
        <tr>
            <td colspan="6"><strong>Parts Library</strong></td>
        </tr>
        <tr>
            <td valign="top">Description/Identifier:</td>
            <td valign="top"><select name="txt_desc" onchange="part_details(this.value)">
            <option value="" selected="selected">&nbsp;</option>
            <?php
            $susql= mysql_query("select * from tbl_protype");
            while ($supsql = mysql_fetch_object($susql))
            {?>
            <option value="<?php echo $supsql->part_id;?>"><?php echo $supsql->part_description;?>-<?php echo $supsql->part_identifier;?></option>
            <?php 
            } ?>
            </select>      
            </td>
            <td>Company P/N</td>
            <td><input type="text" name="txt_part" id="txt_part" /> </td>
            <td>Footprint</td>
            <td><input type="text" name="txt_foot" id="txt_foot"/></td>
            </td>
        </tr>
        <tr>
            <td valign="top">Designator</td>
            <td><input type="text" name="txt_desig" onblur="designator(this.value)"/></td>
            <td valign="top">Price</td>
            <td><input type="text" name="txt_price" id="txt_price" /></td>                  
            <td valign="top">Total Cost</td>
            <td><input type="text" name="txt_tcost" id="txt_tcost" /></td>            
       </tr>
        <tr>
            <td colspan="6"><div id="nrows"></div></td>
        </tr>
        <tr>
            <td colspan="6"><a href="" name="npart" id="npart" class="npart">Add New Part</a></td>
        </tr>           
        <tr>
            <td colspan="6" align="left"><input type="submit" id="submit" value="submit"></td>
        </tr>
    </table>
</form>
<?php @$i = $_REQUEST['frmnm'];
echo $i;
?>
    <form name="parts_exp<?php echo $i;?>">
    <table cellpadding="1" cellspacing="">            
       <tr>
            <td valign="top">Description/Identifier:</td>
            <td valign="top"><select name="txt_desc" onchange="part_details(this.value)">
            <option value="" selected="selected">&nbsp;</option>
            <?php
            $susql= mysql_query("select * from tbl_protype");
            while ($supsql = mysql_fetch_object($susql))
            {
            ?>
            <option value="<?php echo $supsql->part_id;?>"><?php echo $supsql->part_description;?>-<?php echo $supsql->part_identifier;?></option>
            <?php 
            } ?>
            </select>      
            </td>
            <td>Company P/N <?php // echo $frmnm;?></td>
            <td><input type="text" name="txt_part" id="txt_part" /> </td>
            <td>Footprint</td>
            <td><input type="text" name="txt_foot" id="txt_foot"/></td>
            </td>
        </tr>
        <tr>
            <td valign="top">Designator</td>
            <td><input type="text" name="txt_desig" onblur="designator(this.value)"/></td>
            <td valign="top">Price</td>
            <td><input type="text" name="txt_price" id="txt_price" /></td>                  
            <td valign="top">Total Cost</td>
            <td><input type="text" name="txt_tcost" id="txt_tcost" /></td>            
       </tr>
    </table></form>
EXP.php文件将是

<form name="zone_form" method="post" action="product_code.php" onsubmit="">
    <input type="hidden"  name="frmtype" value="new_product" />
    <table width="100%" border="0" cellpadding="2" cellspacing="0">
        <tr>
            <td valign="top">Product Name:</td>
            <td><input type="text" name="txt_pro" /></td>
            <td valign="top">Product Quantity:</td>
            <td><input type="text" name="txt_pquan" id="txt_pquan" onblur="tamount(this.value)" /></td>
            <td valign="top">Total Amount</td>
            <td><input type="text" name="txt_pamount" id="txt_pamount" /></td>
        </tr>
        <tr>
        </tr>
        <tr>
            <td colspan="6">&nbsp;</td>
        </tr>
        <tr>
            <td colspan="6"><strong>Parts Library</strong></td>
        </tr>
        <tr>
            <td valign="top">Description/Identifier:</td>
            <td valign="top"><select name="txt_desc" onchange="part_details(this.value)">
            <option value="" selected="selected">&nbsp;</option>
            <?php
            $susql= mysql_query("select * from tbl_protype");
            while ($supsql = mysql_fetch_object($susql))
            {?>
            <option value="<?php echo $supsql->part_id;?>"><?php echo $supsql->part_description;?>-<?php echo $supsql->part_identifier;?></option>
            <?php 
            } ?>
            </select>      
            </td>
            <td>Company P/N</td>
            <td><input type="text" name="txt_part" id="txt_part" /> </td>
            <td>Footprint</td>
            <td><input type="text" name="txt_foot" id="txt_foot"/></td>
            </td>
        </tr>
        <tr>
            <td valign="top">Designator</td>
            <td><input type="text" name="txt_desig" onblur="designator(this.value)"/></td>
            <td valign="top">Price</td>
            <td><input type="text" name="txt_price" id="txt_price" /></td>                  
            <td valign="top">Total Cost</td>
            <td><input type="text" name="txt_tcost" id="txt_tcost" /></td>            
       </tr>
        <tr>
            <td colspan="6"><div id="nrows"></div></td>
        </tr>
        <tr>
            <td colspan="6"><a href="" name="npart" id="npart" class="npart">Add New Part</a></td>
        </tr>           
        <tr>
            <td colspan="6" align="left"><input type="submit" id="submit" value="submit"></td>
        </tr>
    </table>
</form>
<?php @$i = $_REQUEST['frmnm'];
echo $i;
?>
    <form name="parts_exp<?php echo $i;?>">
    <table cellpadding="1" cellspacing="">            
       <tr>
            <td valign="top">Description/Identifier:</td>
            <td valign="top"><select name="txt_desc" onchange="part_details(this.value)">
            <option value="" selected="selected">&nbsp;</option>
            <?php
            $susql= mysql_query("select * from tbl_protype");
            while ($supsql = mysql_fetch_object($susql))
            {
            ?>
            <option value="<?php echo $supsql->part_id;?>"><?php echo $supsql->part_description;?>-<?php echo $supsql->part_identifier;?></option>
            <?php 
            } ?>
            </select>      
            </td>
            <td>Company P/N <?php // echo $frmnm;?></td>
            <td><input type="text" name="txt_part" id="txt_part" /> </td>
            <td>Footprint</td>
            <td><input type="text" name="txt_foot" id="txt_foot"/></td>
            </td>
        </tr>
        <tr>
            <td valign="top">Designator</td>
            <td><input type="text" name="txt_desig" onblur="designator(this.value)"/></td>
            <td valign="top">Price</td>
            <td><input type="text" name="txt_price" id="txt_price" /></td>                  
            <td valign="top">Total Cost</td>
            <td><input type="text" name="txt_tcost" id="txt_tcost" /></td>            
       </tr>
    </table></form>


@$i=$\u请求['frmnm']
非常糟糕,并且您的代码易受XSS攻击,请检查这一点。您是否可以指定此代码中的错误类型。。。。。为了避免错误,我只在php变量前面加了@symbol。。。。