Page 2 of 2

Re: How do you stop errors of invalid .inc files?

Posted: Wed Apr 25, 2012 11:13 am
by simonmlewis
Ok - I should be trying this out tomorrow so will update this page when testing done.
Thanks everyone.

Re: How do you stop errors of invalid .inc files?

Posted: Thu Apr 26, 2012 4:41 am
by simonmlewis
[text]Parse error: syntax error, unexpected ':' in C:\xampp\phpMyAdmin\site\index.php on line 90[/text]
I've getting this error, based on

Code: Select all

    header(Location: '/book' );

Re: How do you stop errors of invalid .inc files?

Posted: Thu Apr 26, 2012 9:15 am
by x_mutatis_mutandis_x
That was my bad. "Location:" should be in quotes as well, sorry about that

Code: Select all

header('Location: /book');

Re: How do you stop errors of invalid .inc files?

Posted: Fri Apr 27, 2012 8:47 am
by simonmlewis
[text]Fatal error: Call to undefined function processBook() in C:\xampp\phpMyAdmin\site\index.php on line 86[/text]
I'm now getting this error.

Re: How do you stop errors of invalid .inc files?

Posted: Fri Apr 27, 2012 11:39 am
by x_mutatis_mutandis_x
simonmlewis wrote:[text]Fatal error: Call to undefined function processBook() in C:\xampp\phpMyAdmin\site\index.php on line 86[/text]
I'm now getting this error.
That was a function I used as an example. You need to implement it (whether you store it in a DB, or write it to file, or just do nothing, its up to you). For now you can just write a function with empty body so the error won't show up.

Code: Select all

function processBook() {
     //TODO need to implement this function
}

Re: How do you stop errors of invalid .inc files?

Posted: Mon Apr 30, 2012 5:39 am
by simonmlewis
Whether I put that 'function' outside <?php or inside it, I still get the same undefined function error.

Re: How do you stop errors of invalid .inc files?

Posted: Mon Apr 30, 2012 9:05 am
by x_mutatis_mutandis_x
simonmlewis wrote:Whether I put that 'function' outside <?php or inside it, I still get the same undefined function error.
Can you send me the source code you have so far?

Re: How do you stop errors of invalid .inc files?

Posted: Mon Apr 30, 2012 4:38 pm
by simonmlewis

Code: Select all

<?php 
function processBook() {
     //TODO need to implement this function
}

if ($_GET['page'] == 'book') {

if (!empty($_POST)) {

$errorCode = processBook();

if ($errorCode == 0) {
header('Location: /book' );
} else {
header('Location: /book'); //or if showing errors in form header(Location: "/book?errorCode=$errorCode");
}

} else {
//show form html for '/book' request
//(and error message if passing the error code)
}
}
I originally had this in the index.php file, but it is now in book.inc.

I now get:
[text]Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\phpMyAdmin\site\index.php:60) in C:\xampp\phpMyAdmin\site\includes\book.inc on line 103[/text]

Re: How do you stop errors of invalid .inc files?

Posted: Wed May 02, 2012 9:06 am
by x_mutatis_mutandis_x
simonmlewis wrote:

Code: Select all

<?php 
function processBook() {
     //TODO need to implement this function
}

if ($_GET['page'] == 'book') {

if (!empty($_POST)) {

$errorCode = processBook();

if ($errorCode == 0) {
header('Location: /book' );
} else {
header('Location: /book'); //or if showing errors in form header(Location: "/book?errorCode=$errorCode");
}

} else {
//show form html for '/book' request
//(and error message if passing the error code)
}
}
I originally had this in the index.php file, but it is now in book.inc.

I now get:
[text]Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\phpMyAdmin\site\index.php:60) in C:\xampp\phpMyAdmin\site\includes\book.inc on line 103[/text]
And line 103 in book.inc is? Line 60 in index.php? Also, return something from "processBook()" function:

Code: Select all

function processBook() {
     //TODO need to implement this function
    $errorCode = 0;
    return $errorCode;
}