dty98339 2015-04-09 06:44
浏览 57
已采纳

从html表单保存数据库中的值

I have a form where the image is getting displayed with a link that is getting carried from behind.

<form action="a_insert_vendor.php" method="post">
    <div class="module_content">
        <article class="stats_graph">
            <div class="module_content">

                <fieldset>
                    <label>Name</label>
                    <textarea rows="2" name="name"><? echo $_GET['fn'];?></textarea>
                </fieldset>     

            </div>
        </article>

        <article class="stats_overview" style=" margin-right:60px; height:120px; width:120px;">
            <img name="image" src="<? echo $_GET['p'];?>" width="120" height="120" alt="word" />
        </article>

        <div class="clear"></div>
    </div>
    <footer>
        <div class="submit_link">
            <input type="submit" name="submit" value="Submit" class="alt_btn">
        </div>
    </footer>
</form>

Everything gets saved or lets say gets carried to next page, in this form i am able to carry the name and save it in database, but in the case of image, it seems that i am not able to fetch and carry it to next page.

i tried this on a_insert_vendor.php page

$image = mysqli_real_escape_string($con, $_POST['image']);
$sql="INSERT INTO vendor(imagee) VALUES ('$image')";
if (!mysqli_query($con,$sql)) 
{
  die('Error: ' . mysqli_error($con));
}

But it showed no result. can anyone guide me

  • 写回答

1条回答 默认 最新

  • doutao4480 2015-04-09 06:50
    关注

    if you want save link to image, you must add hidden field with link value, for example insert in your form:

    <input type="hidden" name="image" value="<? echo $_GET['p']; ?>">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)