【问题标题】:How can I change this html code that take value from text-box after enter submit button?输入提交按钮后,如何更改从文本框中获取值的 html 代码?
【发布时间】:2014-11-16 13:24:59
【问题描述】:

我有一个文本框和一个提交按钮,它们通过事件函数连接到 html 表单。

Html 代码如下。我想代替 Pic.jpg,输入提交按钮后选择文本框的值。

<html>
    <body>
        <img src="http://example.com/images/Pic.jpg"/>
    </body>
</html>

换句话说,我希望地址的最后一部分,即图像名称从文本框中获取值。

这是我在 html 中的提交按钮代码。

<input type="submit" id="Button1" onblur="ShowObject('Html_Form', 1);return false;" name="" value="Lookup" style="position:absolute;width:99px;height:25px;">

和文本框的html代码:

<input type="text" id="Editbox1" style="position:absolute;line-" name="q" value="" placeholder="Enter You Code Here!">

【问题讨论】:

  • example.com/images/Pic.jpg"> 你知道我的图片文件夹中有几张带有特定 ID 的照片。我想要 html 代码显示我在文本框中输入的 id 的图像。
  • 需要查看提交操作的代码
  • 它的提交按钮代码。
  • 将其添加到问题中
  • 你说:“我有一个文本框和一个提交按钮,通过事件函数连接到 html 表单”我们需要看看你如何提交你的表单,如果它使用 javascript 函数而不是我们需要看到那个功能。此外,将 html 提供给包含该文本框的页面。

标签: php html


【解决方案1】:

您可以从发布的文本框中读取值:

$_REQUEST、$_POST 或 $_GET

<?php

$pic_file_name = $_REQUEST['inputbox'];

?>

<html>
    <body>
        <img src="http://example.com/images/<?php echo $pic_file_name; ?>"/>
    </body>
</html>

【讨论】:

  • 谢谢...谢谢...谢谢@xandrej 谢谢...有效
猜你喜欢
  • 2017-09-11
  • 1970-01-01
  • 2014-05-03
  • 2014-09-17
  • 2015-10-25
  • 1970-01-01
  • 1970-01-01
  • 2013-10-15
  • 1970-01-01
相关资源
最近更新 更多