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.
include_once('functionProgram.inc');
if (!isset($_SESSION['pointer'])) {$_SESSION['pointer']=0;}
displayStyles('<center><b><h1>MENU PROGRAMU</h1><b></center><br><br><br><br><br><br><br><br>'); // Wyświetlamy style
startForm('control.php');
menu();
endForm();
Kolejny krok to control.php
include_once('functionProgram.inc');
include_once('libDB.inc');
if(isset($_POST['menu'])) {
switch($_POST['menu'])
{
case"wyswietl":
header('Location: $displayData.php'); case "edytuj":
header('Location: editData.php');break
; case "usuwanie":
header("Location: delData.php");break
; case "wpisywanie":
header('Location: insertData.php');break
; case "koniec":
header('Location: exitProgram.php');break
; default:
echo "MESSAGE: błąd operacji<br/>";break
; }
}else if(isset($_POST['wyswietl'])) {
switch ($_POST['wyswietl'])
{
case "first":
$_SESSION['pointer']=0;
header("Location: displayData.php");break
; case "next":
if($_SESSION['pointer']<$_SESSION['lenght']-1){$_SESSION['pointer']++;}
header("Location: displayData.php");break
; case "prev":
if($_SESSION['pointer']>0){$_SESSION['pointer']--;}
header("Location: displayData.php");break
; case "last":
$_SESSION['pointer']=$_SESSION['lenght']-1;
header("Location: displayData.php");break
; case "menu":
header("Location: startProgram.php");break
; default:
echo "MESSAGE: błąd operacji<br/>";break
; }
}else if(isset($_POST['edit'])) {
switch ($_POST['edit'])
{
case "first":
$_SESSION['pointer']=0;
header("Location: editData.php");break
; case "next":
if($_SESSION['pointer']<$_SESSION['lenght']-1){$_SESSION['pointer']++;}
header("Location: editData.php");break
; case "prev":
if($_SESSION['pointer']>0){$_SESSION['pointer']--;}
header("Location: editData.php");break
; case "last":
$_SESSION['pointer']=$_SESSION['lenght']-1;
header("Location: editData.php");break
; case "ok":
if($_SESSION['lenght']>0)
{
fetchData($data,$label,$select);
$dataOld=$data;
if (validateData($data))
{setData('student','miasto',$label,$data,$select);}
}
header("Location: editData.php");break
; case "menu":
header("Location: startProgram.php");break
; default:
echo "MESSAGE: błąd operacji<br/>";break
; }
}else if(isset($_POST['insert'])) {
switch ($_POST['insert'])
{
case "insert":
fetchData($data,$label,$select);
if (validateData($data))
{insertData($data,$label,'student','miasto',$select);}
header("Location: insertData.php");break
; case "menu":
header("Location: startProgram.php");break
; default:
echo "MESSAGE: błąd operacji<br/>";break
; } // end switch ($_POST['insert'])
}else if(isset($_POST['delete'])) {
switch ($_POST['delete'])
{
case "first":
$_SESSION['pointer']=0;
header("Location: delData.php");break
; case "next":
if($_SESSION['pointer']<$_SESSION['lenght']-1){$_SESSION['pointer']++;}
header("Location: delData.php");break
; case "prev":
if($_SESSION['pointer']>0){$_SESSION['pointer']--;}
header("Location: delData.php");break
; case "last":
$_SESSION['pointer']=$_SESSION['lenght']-1;
header("Location: delData.php");break
; case "delete":
if($_SESSION['lenght']>0)
{
fetchData($data,$label,$select);
deleteData('student',$label);
}
header("Location: delData.php");break
; case "menu":
header("Location: startProgram.php");break
; default:
echo "MESSAGE: błąd operacji<br/>";break
; }
}else if(isset($_POST['exit'])) {
switch ($_POST['exit'])
{
case "exit":
header("Location: startProgram.php");break
; default:
echo "MESSAGE: błąd operacji<br/>";break
; }
}
Wybranie czegokowiek z wyświetlanego menu skutkuje białym ekranem. Ja błedu niestety znaleźć nie umiem. Czyżby celowo coś było pomylone?
Ten post edytował poliocertes 1.02.2013, 18:33:00