Page 1 of 1

HTML_Quickform_controller not getting $_GET variables?

Posted: Tue Nov 04, 2003 9:08 am
by Beek
Hi. This is my first post on the forum, so please bear with me :oops:

I'm trying to build some complex forms with php, more precise with the
HTML_Quickform_controller package available from the PEAR network.

What I try to do is the following: when I click on a certain link, a new page
(a form) gets opened in a new window, and I pass some variables
together with the URL of the form. An example would be:

Code: Select all

window.open("removeMe.php?var1=1&var2=2")
Now, in the file removeMe.php, I subclass HTML_QuickForm_Page to
create my form. (code below) However, the 'hidden' elements do not
work. They set the correct value the first time I call the page, but
every next call (with different parameters) leaves these hidden fields
on the same values as the first time. (Note that the $var1 variable
DOES change, strangemy enough!)

This is the relevant code:

Code: Select all

class Remove extends HTML_QuickForm_Page {
  function buildForm() {
    $this->formBuilt = true;
    $var1 = isset($_GETї'var1']) ? $_GETї'var1'] : "neverused";
    $var2 = isset($_GETї'var2']) ? $_GETї'var2'] : "neverused";

    $this->addElement('header', null, 'Variable is ' . $var1) //This works each time!!

    //$this->addElement( .... add some elements ....);

    $this->addElement('hidden', 'var1', $var1); //This only works the first time and then remains unchanged forever???
    $this->addElement('hidden', 'var2', $var2);

    $this->addElement('submit', $this->getButtonName('submit'), 'Remove');
    $this->setDefaultAction('submit');
  }
}
I've checked the documentation and the source, but couldn't find out why
this is happening. Any help would be appreciated.

Thanks in advance,

Beek

Posted: Tue Nov 04, 2003 12:11 pm
by kendall
Beek,

Well...i would need to see the part that actually prints the 'hidden' element to see if there is probaly some mistake...i doubt it but other than that maybe you should be using $_POST or $HTTP_POST_VARS instead of $_GET or $HTTP_POST_VARS but it also seems that your calling the script from a query string
so you need to tell me what you mean by
They set the correct value the first time I call the page, but
every next call (with different parameters) leaves these hidden fields
on the same values as the first time.
cause im not sure what you're saying here

Kendall