Jump to content

roshni

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by roshni

  1. Hi All, I had used wrong method name and was wasting my time and your too Thanks to all who helped solved my original problem. Roshni.
  2. Thank you all for the valuable suggestions for my problem. It helped solve it. I now am having issue with the lost method of the object. I get the following output: Array ( [id] => O:8:"BabyName":5:{s:18:"BabyNamebabyName";s:6:"Akriti";s:16:"BabyNamegender";s:4:"Girl";s:17:"BabyNamemeaning";s:16:"Picture, Diagram";s:16:"BabyNameorigin";N;s:19:"BabyNamenoOfLikes";s:1:"1";} )object(BabyName)[7] private 'babyName' => string 'Akriti' (length=6) private 'gender' => string 'Girl' (length=4) private 'meaning' => string 'Picture, Diagram' (length=16) private 'origin' => null private 'noOfLikes' => string '1' (length=1) ( ! ) Fatal error: Call to undefined method BabyName::getName() in C:\wamp\www\babyNames\babyNameDetails.php on line 34 Call Stack # Time Memory Function Location 1 0.0011 688280 {main}( ) ..\babyNameDetails.php:0 I have this on my php page: <?php include_once('BabyName.php'); print_r ($_GET); $babyName = unserialize(urldecode($_GET['id'])); var_dump($babyName); echo "babyName: " . $babyName->getName(); It seems we cannot serialize object methods. How do we work around getting the object methods? Or is their another way of doing it? Thank you, Roshni
  3. Hi All, I think I am getting it now. I let you all know it few minutes if I need more suggestions Thank you all. Roshni
  4. Thank you CyberRobot. I tried serializing then encoding ...then sending over URL then decoding and then unserializing. But still I am having problems. $name = "Akriti"; $babyNameSerialized = urlencode(serialize($babyName)); $url = "babyNameDetails.php?".$babyNameSerialized; <td style="font-weight: bold;" ><?php echo "<a href=\"{$url}\">{$name}</a>"; ?></td> and in <?php include_once('BabyName.php'); print_r ($_GET); $id = $_REQUEST['id']; echo "<br>" . "id: " . $id . "<br>"; $babyName = unserialize(urldecode($_GET['id'])); echo "babyName: " . $babyName; This is what I get: Array ( [O:8:"BabyName":5:{s:18:"] => ) id: babyName: I can see the encoded data in the URL though. So the BabyName object is sent in the URL but I am not able to receive it. But I am not able to get in the $_GET or$_REQUEST. Please suggest me. Thanks, Roshni
  5. Thanks Muddy_Funster. I tried what you suggested. But in the receiving page it is: Array ( [id] => 'O:8: ) It is the same thing as I was getting before. If you could suggest be something else too, I would try. Thank you, Roshni
  6. i am so sorry I posted more than once. I did not realized I had posted more than once because everytime I hit the submit post button I would get "page cannot be displayed" page. I thought I was not able to post my problem on this forum at all. Thanks for the response.
  7. Hi all, I have been trying to figure out by myself for hours but with no success. I created a object and then serialized it and passed in a URL. include_once("BabyName.php"); $babyName = new BabyName($name, $gender, $meaning, $origin, $likesCount); echo $babyName->getGender(); $babyNameSerialized = serialize($babyName); echo $babyNameSerialized; <a href="babyNameDetails.php?id= '<?php echo $babyNameSerialized ?>'"> <?php echo $name ?></a> I get output:O:8:"BabyName":5:{s:18:"BabyNamebabyName";s:6:"Akriti";s:16:"BabyNamegender";s:4:"Girl";s:17:"BabyNamemeaning";s:16:"Picture, Diagram";s:16:"BabyNameorigin";N;s:19:"BabyNamenoOfLikes";s:1:"1";} Then in babyNameDetails.php file, I get the seriazed babyName. But only O:8 gets printed. It gets serialized properly originally as I can see the echo output. But when I pass through URL, I do not get the serialized string. <?php include_once('BabyName.php'); $id = $_REQUEST['id']; echo "id: " . $id . "<br>"; $babyName = unserialize($id); echo "babyName: " . $babyName; I just get: id: 'O:8: babyName: Please let me know what am I doing wrong. Thank you, Roshni
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.