Likes Likes:  0
Resultaten 1 tot 2 van de 2
Geen
  1. #1
    Marcel
    Passing objects form one page to another
    Gast
    n/a Berichten
    Berichten zijn liked



    Thread Starter

    Passing objects form one page to another

    Hello all,

    Is it possible to transfer objects derived from a class form one page to
    another?

    I made 2 testscripts:

    person.php
    -------------------------------------
    <?php

    class person {

    private $_name;

    public function setName($name) {

    $this->_name = $name;

    }

    public function getName() {

    return $this->_name;

    }

    }


    $p = new person();

    $p->setName("Jim");

    $safep = urlencode(serialize($p));

    header("Locationerson2.php?data=".$safep);

    exit;

    ?>


    person2.php
    ---------------------------------
    <?php

    class person {

    private $_name;

    public function setName($name) {

    $this->_name = $name;

    }

    public function getName() {

    return $this->_name;

    }

    }

    $x = unserialize(urldecode($_GET['data']));

    echo $x->getName();

    ?>

    But this does not work for me....

    Marcel



  2. #2
    Binny V A
    Passing objects form one page to another
    Gast
    n/a Berichten
    Berichten zijn liked



    Thread Starter

    Re: Passing objects form one page to another

    Hello Marcel,

    > Is it possible to transfer objects derived from a class form one page to
    > another?

    Have you tried passing it using session?

    --
    Binny V A
    http://www.bin-co.com/

Webhostingtalk.nl

Contact

  • Rokin 113-115
  • 1012 KP, Amsterdam
  • Nederland
  • Contact
© Copyright 2001-2026 Webhostingtalk.nl.
Web Statistics