| Index
» Projekty
» phpMyEdit
» Fórum
» Passing argument |
 |
jlyons
Založený: 14.01.2004
Príspevky: 2
Zaslal: 2004-01-14 22:55
Návrat hore
Odpovedať s citátom
|
I am using phpMyEdit with a two table database. The first table has a key CustID that is passed as an argument to the second phpMyEdit form in the URL.
secondtable.php?CustID=62
The second form then uses that variable in $opts['filters'] to only display records for that customer. The problem is that when you click the add button to create a new record for the CustID, it does not pass the variable.
How can you send a variable to the Add, Change, Copy buttons?
Thanks in advance,
John
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2004-01-15 13:55
Návrat hore
Odpovedať s citátom
|
you can use ['cgi']['persist'] to pass this variable to next pages. then use 'default'=> $_REQUEST['CustomID'] to make it default.
|
jlyons
Založený: 14.01.2004
Príspevky: 2
Zaslal: 2004-01-15 19:03
Návrat hore
Odpovedať s citátom
|
That did it. I had tried using the ['cgi']['persist'] but I was using the default value wrong. Thanks again for your help.
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2004-01-15 19:42
Návrat hore
Odpovedať s citátom
|
if you did it according to documentation ( http://opensource.platon.sk/projects/doc.php/phpMyEdit/html/configuration.cgi-variables.html ) than the only problem is see is that your variable name is used by PME somewhere. try to change it to something another (longer).also remember that the variable can change from GET to POST and back any time.
|
damir
Založený: 17.03.2004
Príspevky: 2
Zaslal: 2004-03-17 16:36
Návrat hore
Odpovedať s citátom
|
I have a similar situation here. I must pass the session variable to the class but always get an error:
Fatal error: Call to a member function on a non-object in /Library/WebServer/...
Here is my code for filtering a table using userID as a persistent variable:
$opts['cgi']['persist'] = array(
'myvar' => $HTTP_SESSION_VARS['userID']
);
$opts['fdd']['reg_broj'] = array(
'name' => 'Reg broj',
'select' => 'T',
'maxlen' => 7,
'sort' => true
);
$opts['filters'] = 'reg_broj ='. $this->get_cgi_var("myvar");
How to access those persistent variables? $this->get_cgi_var("myvar") wont work. Thanks.
Naposledy upravil damir dňa 2004-03-17 19:45, celkom upravené 1 krát
|
damir
Založený: 17.03.2004
Príspevky: 2
Zaslal: 2004-03-17 19:43
Návrat hore
Odpovedať s citátom
|
It won't work because the object doesn't exist before the phmmyedit class is called. I found the workaround for this in the forum but still got a problem.
$opts['fdd']['id'] = array(
'name' => 'ID',
'select' => 'T',
'options' => 'AVCPDR', // auto increment
'maxlen' => 11,
'default' => '0',
'sort' => true,
'something_dummy' => $myvar
);
$opts['filters'] = 'reg_broj ='. $opts['fdd']['id'][something_dummy];
It works only first time the page is loaded, then after i submit the form 'myvar' variable and all session variable are lost. I need a way to preserve all those variables.
I've tried also
$opts['cgi']['persist'] = array(
'xxx' => $myvar
);
$opts['filters'] = 'reg_broj ='. $opts['cgi']['persist']['xxx'];
and the result is the same as above example.
I searched the forum for $opts['cgi']['persist'] array but still don't know how to use them.
Thanks.
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|