【问题标题】:Post two values from input field with php使用php从输入字段中发布两个值
【发布时间】:2017-10-12 08:53:54
【问题描述】:

我有一些注册将标签作为值发送到服务器

<input type="hidden" id="tag-sm" name="tag-sm" value="workshops_10.2017">

现在我必须发送两个不同的标签

<input type="hidden" id="tag-sm" name="tag-sm" value1="workshops_10.2017" value2="events">

这是我的 php:

$obj = array(
   'first-name' => htmlspecialchars($_POST['first-name']),
   'last-name' => htmlspecialchars($_POST['last-name']),
   'email' => htmlspecialchars($_POST['email']),
   'phone' => (isset($_POST['phone'])) ? 
   'tag' => htmlspecialchars($_POST['tag-sm']),
   'discount-codes' => (isset($_POST['discount-codes'])) ? 
);

如何用php获取这两个值?

【问题讨论】:

标签: php html forms


【解决方案1】:

为两者创建一个单独的input

<input type="hidden" id="tag-sm-1" name="tag-sm-1" value="workshops_10.2017">
<input type="hidden" id="tag-sm-2" name="tag-sm-2" value="events">

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-18
    • 2022-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-10
    • 1970-01-01
    • 2011-09-06
    相关资源
    最近更新 更多