473,324 Members | 2,511 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

unserialize() isn't working....

Hi everyone.
I have some troubles using the unserialize() function.

I have serialized an array and that works perfect:

echo '<input type="hidden" name="vardekedja" value="'.serialize($_POST
['vardekedja']).'">';

Gives the output:
a:3:{i:0;s:7:

Then on a later page I write:
$vardekedja = $_POST['vardekedja'];
$varde = unserialize($vardekedja);
echo $vardekedja; echo '
';
echo $varde; echo '
';
echo 'why?';

And, as I echoed out, WHY?

why isn't it working??

Please help!
/Sebastian

Jul 17 '05 #1
1 2191
Sebastian Aguilera wrote:
Hi everyone.
I have some troubles using the unserialize() function.

I have serialized an array and that works perfect:

echo '<input type="hidden" name="vardekedja" value="'.serialize($_POST
['vardekedja']).'">';

Gives the output:
a:3:{i:0;s:7:

Then on a later page I write:
$vardekedja = $_POST['vardekedja'];
$varde = unserialize($vardekedja);
echo $vardekedja; echo '
';
echo $varde; echo '
';
echo 'why?';

And, as I echoed out, WHY?

why isn't it working??


Have you tried "View Source"?

serialize() uses double quotes (") and these quotes don't mix well with
the HTML quotes!
try htmlentities()

echo '<input type="hidden" name="vardekedja" value="'
. htmlentities(serialize($_POST['vardekedja']))
. '">';

But why are you serializing the $_POST array to put _into_ the form?
Well ... try it :-)
--
--= my mail address only accepts =--
--= Content-Type: text/plain =--
--= Size below 10K =--
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mark | last post by:
Greetings: So, I've got a real problem in that PHP doesn't seem to be able to unserialize() an array that has an element containing a newline. Of course, I've used htmlentities() to protect the...
1
by: Spam sucks | last post by:
Hello, Could somebody explane to me how i can unserialize the content of a session file, i allready reading the session files and the content now i only need to unserialize the data in the...
2
by: Andrew | last post by:
Some have suggested that using serialize() and unserialize is faster than reading/writing an array to disk as a simple text file using $array = file('numbers.txt'); Can anyone justify this? ...
7
by: richbl | last post by:
Hello all, I have a question about unserializing a single array element from a serialized array. Can this be done, or must I first unserialize the array, and then access the element? For...
6
by: sandy | last post by:
With java servlets I can declare complex object-oriented class structures as session variables in a servlet. That means I can have a complex HTML form that submits iteratively back to the server...
2
by: onefastmustang | last post by:
I have a cookie that I serialize and set as follows.. $searchdata = $state; $searchdata = $country; $searchdata = $radius; $searchdata = $radius_zip; if ($_GET){ foreach ($_GET as $value){...
5
by: Mike | last post by:
I finally got serialize to work but now I cannot get unserialize to work. Here is my code. $settings = serialize($settings_array); echo "<INPUT TYPE='Hidden' NAME='settings'...
7
by: powellgg | last post by:
I've just taken over a PHP website and am converting it to ASP.NET (don't shoot!). I'm not a PHP guy so I'm doing a lot of searching for things that I aren't obvious, and I'm hoping I'll be able...
8
by: carrion | last post by:
Hello everyone! I'm currently working on a MVC-framework and have run into an issue. I'm using separate script files to render the active page's CSS and Javascript Code. I want to pull the data...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.