dongrong9938 2014-01-09 07:38
浏览 16

上传图片并不是PHP中的多个FORM

I've a PHP page which takes user inputs like first name, last name and also allows user to select & upload image, these details need to be saved to database. I'm uploading the image using ajax so that page is not refreshed. The upload works fine, but the save is not working, I guess this is because of the inner FORM tag? Can anyone please suggest how to make upload and save working in the same page? Below is my code:

<form name="frm1" id="frm1" method="post" action="product_db.php" enctype="multipart/form-data" onsubmit="return submitForm(this);">
<table width="100%" id="mem_det" >
                            <tr >
                                <td width="20%" style="font-style:italic;">Product ID</td>
                                <td width="40%">
                                    <label style="font-style:normal;"><?php echo $lid; ?></label>
                                </td>
                                    <input type="hidden" name="product_id" id="product_id" value="<?php echo $lid; ?>" />
                                <td>&nbsp;</td>
                            </tr>
</table>
<form id="vasPLUS_Programming_Blog_Form" method="post" enctype="multipart/form-data" action="javascript:void(0);" autocomplete="off">
<div>Browse Image:</div>
<input type="file" name="vasPhoto_uploads" id="vasPhoto_uploads">
</form>
<div>
<input type="submit"  value="" style="background:url(img/save.png) right no-repeat;"/>
                </div>
</form>
  • 写回答

2条回答 默认 最新

  • douhan9191 2014-01-09 07:39
    关注

    You cannot have one form inside another form.

    Either use a single form, or move one of them outside the other.

    And use a validator.

    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line