简体   繁体   中英

Post two values from input field with php

I have some registration which sends tag as a value to the server

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

Now I must send two different tags

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

this is my 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'])) ? 
);

how to get these two values with php ?

Create a separate input for the two

<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">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM