Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, November 11, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  Forceing a $variable into a field

phpMyEdit General     Forceing a $variable into a field
Post new topic   Reply to topic    
 
Lonestarjack     Joined: 25 Oct 2011   Posts: 1  
Post Posted: 2011-10-25 15:43
Back to top  Reply with quote     

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     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2011-10-26 17:50
Back to top  Reply with quote     

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:

Code:
$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

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy