Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:entwickler:zuruecknavigieren_mit_vorbelegten_feldern [2015/11/04 20:19]
thomas-rcv created
en:entwickler:zuruecknavigieren_mit_vorbelegten_feldern [2016/12/03 15:03] (current)
ximex codestyle and typos
Line 7: Line 7:
 Based on the maintenance dialog of the announcements the procedure will now be described: ​ Based on the maintenance dialog of the announcements the procedure will now be described: ​
  
-The first thing you must secure these entries in a session variable at the beginning of //​announcements_function.php//​ that handles the user input from the form. To not edit now all $ _GET or $ _POST seperate ​there is a PHP variable **$_REQUEST** that includes the contents of both arrays and the $ _COOKIE array. The name of the $_SESSION variable should be unique per request form and end with **_request**,​ so you know what is meant and different forms do not overwrite the data. <code php> $_SESSION['​announcements_request'​] = $_REQUEST; </​code>​+The first thing you must secure these entries in a session variable at the beginning of //​announcements_function.php//​ that handles the user input from the form. To not edit now all **$_GET** or **$_POST** separate ​there is a PHP variable **$_REQUEST** that includes the contents of both arrays and the **$_COOKIE** array. The name of the $_SESSION variable should be unique per request form and end with **_request**,​ so you know what is meant and different forms do not overwrite the data. <code php> $_SESSION['​announcements_request'​] = $_REQUEST; </​code>​
  
 Now, the contents must be processed in //​announcements_new.php//​. ​ Now, the contents must be processed in //​announcements_new.php//​. ​
  
-If you work here **with** a table class, so there is a very easy way to demonstrate the fields again: <code php> if(isset($_SESSION['​announcement_request'​]))+If you work here **with** a table class, so there is a very easy way to demonstrate the fields again: <code php> if (isset($_SESSION['​announcement_request'​]))
 { {
-    foreach($_SESSION['​announcement_request'​] as $key => $value)+    foreach ($_SESSION['​announcement_request'​] as $key => $value)
     {     {
-        if(strpos($key, ​"ann_") == 0)+        if (strpos($key, ​'ann_') == 0)
         {         {
             $announcement->​setValue($key,​ stripslashes($value));​             $announcement->​setValue($key,​ stripslashes($value));​
Line 25: Line 25:
 When working **without** Table access class must be removed the following: When working **without** Table access class must be removed the following:
  
-For this purpose, you should create best practice for each field on the form a variable. If now **$ _ SESSION ​['​announcements_request'​]** exists, ​ the variable can be filled ​ with the old content, otherwise they will simply initialized.<​code php> if(isset($_SESSION['​announcements_request'​]))+For this purpose, you should create best practice for each field on the form a variable. If now **$_SESSION ​['​announcements_request'​]** exists, the variable can be filled with the old content, otherwise they will simply initialized.<​code php> if (isset($_SESSION['​announcements_request'​]))
 { {
- $form_values ​= strStripSlashesDeep($_SESSION['​announcements_request'​]);​+ $formValues ​= strStripSlashesDeep($_SESSION['​announcements_request'​]);​
  unset($_SESSION['​announcements_request'​]);​  unset($_SESSION['​announcements_request'​]);​
 } }
 else else
 { {
- $form_values['​headline'​] ​   = " "+ $formValues['​headline'​] ​   = ' '
- $form_values['​description'​] = " "+ $formValues['​description'​] = ' '
- $form_values['​global'​] ​     = 0;  + $formValues['​global'​] ​     = 0;  
- if ($_GET["ann_id"] != 0)+ if ($_GET['ann_id'] != 0)
  {  {
  ... Reading the id - dataset and preassign the $field variable with the data from the database ...  ... Reading the id - dataset and preassign the $field variable with the data from the database ...
  • en/entwickler/zuruecknavigieren_mit_vorbelegten_feldern.txt
  • Last modified: 2016/12/03 15:03
  • by ximex