I have a dictionary 开发者_运维问答in JSON form, like this:
$user = "{ name: Mary , born: 1963, money: 213 }";
I need to pass it through this field:
<input type="hidden" name="custom" value="" >
and then insert it in the database:
INSERT INTO user ( name, born, money ) VALUE ( $name, $born, $money )
As far as putting it in a hidden input is concerned, it is just text. So do with it what you would do with any other text. (i.e. run htmlspecialchars over it and drop it in there).
Then use PHP's JSON functions to turn it into a data structure then you can pick the bits you care about out of and stuck them into a prepared SQL statement.
精彩评论