Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Štvrtok, 26. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Forceing a $variable into a field

phpMyEdit General     Forceing a $variable into a field
Odoslať novú tému   Odpovedať na tému    
 
Lonestarjack     Založený: 25.10.2011   Príspevky: 1  
Príspevok Zaslal: 2011-10-25 15:43
Návrat hore  Odpovedať s citátom     

I would like to force a $selected_recipe variable into a field on an ADD and have a drop down for the CHANGE option.
The change option works, but I can't get SQL or SQLW to work.
$opts['fdd']['recipe'] = array(
'name' => 'Recipe',
'options' => 'CPVD',
'select' => 'D',
'values' => array(
'table' => 'recipies_names',
'column' => 'recipe',
'colattrs' => 'align="left"',
'sort' => false
)
);


$opts['fdd']['recipe'] = array(
'name' => 'Recipe',
'options' => 'A',
'select' => 'T',
'sqlw' = 'IF(recipe = $val_qas, $val_qas, $selected_recipe)'
)
);

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2011-10-26 17:50
Návrat hore  Odpovedať s citátom     

For starters, as written, $opts['fdd']['recipe'] is appears twice, thus the second entry eliminates (redefines) the first one. You need to conditionally use one or the other based on the current mode of operation ... whether or not $_REQUEST['PME_sys_operation'] is set, and if set then use and if/else loop to conditionally apply one of the two field arrays.

Put the following snipped in your page footer temporarily in order to determine what operations are set, and then conditionally apply the appropriate field array:

Kód:
$print_r_text = preg_replace('/\n/s', "\r\n", print_r($_REQUEST, true));

echo !stristr($print_r_text, ']') ? '' : "\n".'<p>$_REQUEST</p><pre>'.htmlspecialchars($print_r_text).'</pre>';


I think the following is accurate but may not cover all possible page modes.

$_REQUEST['PME_sys_operation'] (if set) will return one of: View, Change, Copy, or Delete

If the above is not set then one of the following is probably set.

$_REQUEST['PME_sys_canceladd'] (if set) returns Cancel
$_REQUEST['PME_sys_cancelchange'] (if set) returns Cancel
$_REQUEST['PME_sys_cancelcopy'] (if set) returns Cancel
$_REQUEST['PME_sys_canceldelete'] (if set) returns Cancel
$_REQUEST['PME_sys_cancelview'] (if set) returns Cancel

$_REQUEST['PME_sys_moreadd'] (if set) returns More

$_REQUEST['PME_sys_morechange'] (if set) returns Apply

$_REQUEST['PME_sys_saveadd'] (if set) returns Save
$_REQUEST['PME_sys_savechange'] (if set) returns Save
$_REQUEST['PME_sys_savecopy'] (if set) returns Save
$_REQUEST['PME_sys_savedelete'] (if set) returns Save

Somewhat unrelated, I believe A (Add) and coPy (P) are related in some manner during processing, such that you should keep them together.

http://www.php-form-generator.com/phpmyedit/cheat-sheet/page_mode.txt

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov