javascript - 图像选择器 html 表单

标签 javascript php html web

我在使用图像选择器 http://rvera.github.io/image-picker/ 时遇到问题

基本上我已经成功地显示了我想要的图像,但我想将其全部包装在一个 html 表单中,调用另一个 php 脚本并为该 php 脚本提供所选图像的值

<form action="dosomething.php" method="get" >
<select id="selectImage" class="image-picker">
<option data-img-src="files/1.jpg" input type="text" name="img" value="1">1</option>
<option data-img-src="files/2.jpg" input type="text" name="img" value="2">2</option>
<option data-img-src="files/3.jpg" input type="text" name="img" value="3">3</option>
</select>
<input type="submit" value="Submit">
</form>

当我单击表单提交操作时,我被指向 dosomething.php 但我的值从未通过 get 传递

有人能给我一些见解吗?

提前致谢

最佳答案

您需要命名您选择的标签。

例如。

<select id="selectImage" class="image-picker" name="image">

然后尝试使用 $_GET['image']; 进行检索

关于javascript - 图像选择器 html 表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26006905/

相关文章:

html - 我的导航栏在移动 View 中去了哪里?

javascript - 从 AngularJS 插值中的数字中删除尾随零

javascript - 第一次脚本

javascript - Three.js raycaster 在我移动鼠标之前选择所有内容

php - Laravel - 如何在 View 中使用/访问 session 变量?

php 版本在应用程序/浏览器中显示不同

javascript - 为什么我需要 4 previousSibling 才能获取 2 个前一个元素?

javascript - 使 knockout 订户关闭模型并再次打开它

php - 对相关表进行分组 Eloquent/Laravel

javascript - 将 HTML <select> 元素显示到特定的 div