0

my code-

$order[$j][1]=$q16;
<input type="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)
3
  • What does $_REQUEST['hdnOrder'] look like? Commented Nov 21, 2010 at 12:16
  • 2
    Perhaps not exactly your question, but why not store that hdnOrder in a session or database and then fetch it after the form? The way you have it the user can tamper with it and then submit an erroneous hdnOrder Commented Nov 21, 2010 at 12:19
  • You put "unrealized" in your title. Commented Nov 21, 2010 at 12:21

2 Answers 2

1

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)));
Sign up to request clarification or add additional context in comments.

Comments

0

You should use urldecode/urlencode instead of htmlentities.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.