开发者

how to get array from unrealized data

开发者 https://www.devze.com 2023-01-26 08:01 出处:网络
my code- $order[$j][1]=$q16; <input typ开发者_如何学Ce=\"hidden\" name=\"hdnOrder\" value=\"<?php echo htmlentities(serialize($order)); ?>\">

my code-

$order[$j][1]=$q16;
<input typ开发者_如何学Ce="hidden" name="hdnOrder" value="<?php echo htmlentities(serialize($order)); ?>">

on my next page-

$order =  array_map('mysql_real_escape_string', unserialize($_REQUEST['hdnOrder']));

it gives me the following error- Warning: array_map() [function.array-map]: Argument #2 should be an array

I want order value in array form because of-

foreach($order as $row)


Your problem is the htmlentities() you are doing on the data.

Use htmlspecialchars(serialize($order), ENT_QUOTES) instead and do a htmlspecialchars_decode() afterwards.

$order =  array_map('mysql_real_escape_string', 
 unserialize(htmlspecialchars_decode($_REQUEST['hdnOrder'], ENT_QUOTES)));


You should use urldecode/urlencode instead of htmlentities.

0

精彩评论

暂无评论...
验证码 换一张
取 消