Od wykładowcy dostaliśmy plik, na którym mamy się zorientować o co chodzi z php+sql. Niestety kod nie działa. Mam plik startProgram.php, który wyświetla mi menu.
  1.  
  2. include_once('functionProgram.inc');
  3. if (!isset($_SESSION['pointer']))
  4. {$_SESSION['pointer']=0;}
  5. displayStyles('<center><b><h1>MENU PROGRAMU</h1><b></center><br><br><br><br><br><br><br><br>'); // Wyświetlamy style
  6. startForm('control.php');
  7. menu();
  8. endForm();


Kolejny krok to control.php

  1. include_once('functionProgram.inc');
  2. include_once('libDB.inc');
  3. if(isset($_POST['menu']))
  4. {
  5. switch($_POST['menu'])
  6. {
  7. case"wyswietl":
  8. header('Location: $displayData.php');
  9. exit();
  10. case "edytuj":
  11. header('Location: editData.php');break;
  12. case "usuwanie":
  13. header("Location: delData.php");break;
  14. case "wpisywanie":
  15. header('Location: insertData.php');break;
  16. case "koniec":
  17. header('Location: exitProgram.php');break;
  18. default:
  19. echo "MESSAGE: błąd operacji<br/>";break;
  20. }
  21. }else if(isset($_POST['wyswietl']))
  22. {
  23. switch ($_POST['wyswietl'])
  24. {
  25. case "first":
  26. $_SESSION['pointer']=0;
  27. header("Location: displayData.php");break;
  28. case "next":
  29. if($_SESSION['pointer']<$_SESSION['lenght']-1){$_SESSION['pointer']++;}
  30. header("Location: displayData.php");break;
  31. case "prev":
  32. if($_SESSION['pointer']>0){$_SESSION['pointer']--;}
  33. header("Location: displayData.php");break;
  34. case "last":
  35. $_SESSION['pointer']=$_SESSION['lenght']-1;
  36. header("Location: displayData.php");break;
  37. case "menu":
  38. header("Location: startProgram.php");break;
  39. default:
  40. echo "MESSAGE: błąd operacji<br/>";break;
  41. }
  42. }else if(isset($_POST['edit']))
  43. {
  44. switch ($_POST['edit'])
  45. {
  46. case "first":
  47. $_SESSION['pointer']=0;
  48. header("Location: editData.php");break;
  49. case "next":
  50. if($_SESSION['pointer']<$_SESSION['lenght']-1){$_SESSION['pointer']++;}
  51. header("Location: editData.php");break;
  52. case "prev":
  53. if($_SESSION['pointer']>0){$_SESSION['pointer']--;}
  54. header("Location: editData.php");break;
  55. case "last":
  56. $_SESSION['pointer']=$_SESSION['lenght']-1;
  57. header("Location: editData.php");break;
  58. case "ok":
  59. if($_SESSION['lenght']>0)
  60. {
  61. fetchData($data,$label,$select);
  62. $dataOld=$data;
  63. if (validateData($data))
  64. {setData('student','miasto',$label,$data,$select);}
  65. }
  66. header("Location: editData.php");break;
  67. case "menu":
  68. header("Location: startProgram.php");break;
  69. default:
  70. echo "MESSAGE: błąd operacji<br/>";break;
  71. }
  72. }else if(isset($_POST['insert']))
  73. {
  74. switch ($_POST['insert'])
  75. {
  76. case "insert":
  77. fetchData($data,$label,$select);
  78. if (validateData($data))
  79. {insertData($data,$label,'student','miasto',$select);}
  80. header("Location: insertData.php");break;
  81. case "menu":
  82. header("Location: startProgram.php");break;
  83. default:
  84. echo "MESSAGE: błąd operacji<br/>";break;
  85. } // end switch ($_POST['insert'])
  86. }else if(isset($_POST['delete']))
  87. {
  88. switch ($_POST['delete'])
  89. {
  90. case "first":
  91. $_SESSION['pointer']=0;
  92. header("Location: delData.php");break;
  93. case "next":
  94. if($_SESSION['pointer']<$_SESSION['lenght']-1){$_SESSION['pointer']++;}
  95. header("Location: delData.php");break;
  96. case "prev":
  97. if($_SESSION['pointer']>0){$_SESSION['pointer']--;}
  98. header("Location: delData.php");break;
  99. case "last":
  100. $_SESSION['pointer']=$_SESSION['lenght']-1;
  101. header("Location: delData.php");break;
  102. case "delete":
  103. if($_SESSION['lenght']>0)
  104. {
  105. fetchData($data,$label,$select);
  106. deleteData('student',$label);
  107. }
  108. header("Location: delData.php");break;
  109. case "menu":
  110. header("Location: startProgram.php");break;
  111. default:
  112. echo "MESSAGE: błąd operacji<br/>";break;
  113. }
  114. }else if(isset($_POST['exit']))
  115. {
  116. switch ($_POST['exit'])
  117. {
  118. case "exit":
  119. header("Location: startProgram.php");break;
  120. default:
  121. echo "MESSAGE: błąd operacji<br/>";break;
  122. }
  123. }
  124.  


Wybranie czegokowiek z wyświetlanego menu skutkuje białym ekranem. Ja błedu niestety znaleźć nie umiem. Czyżby celowo coś było pomylone?