Ok, I know im probably annoying many people witht hese PHP and MySQL posts... So in addition to helping me out on this can anyone point me to a good PHP tutorial for beginners
And now my problem.... It is the same problem... But now I am using case statements instead of if..... When I try to set the default page using case default It gives me a parse error....
This is my code:Code:Parse error: parse error, unexpected T_DEFAULT in D:\Apache\htdocs\book.php on line 20
PS: When I try to do a ?book=1 it tells me this:PHP Code:<?php
$book = $_GET["book"]; // this reads the variable "page" in the array $_GET
switch ($book) {
case 1:
header( "Content-Type: application/pdf" );
readfile( "/books/C#_Book.pdf" );
break;
case 2:
header( "Content-Type: application/pdf" );
readfile( "perl.pdf" );
break;
case 3:
header( "Content-Type: application/pdf" );
readfile( "perl.pdf" );
break;
case 4:
header( "Content-Type: application/pdf" );
readfile( "perl.pdf" );
break;
case default:
header( "Content-Type: text/html" );
readfile( "books.html" );
}
?>
Any idea or a better way of getting this doneCode:Warning: readfile("/books/C#_Book.pdf") - No such file or directory in D:\Apache\htdocs\book.php on line 6





Reply With Quote