I can't run my functions on .php pages

Forum for you who has PHP installation issues

Moderators: egami, macek, gesf

Post Reply
User avatar
gesf
Moderator
Moderator
Posts: 1716
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Mon May 03, 2004 9:41 am

Board_Talk wrote:..when I click a link like the one shown below, it simply reloads the page to the initial default function.

In your link, the value of $act is 'view' and in your switch statement you have only one case... for 'selection'. Or, you don´t have nothing to verify that 'action'!
So... you can make: case "view":, otherwise it will always go to the default function...
Sincerely,
Gonçalo "gesf" Fontoura

gesf.org | sessionstart.com | urlms.com

User avatar
gesf
Moderator
Moderator
Posts: 1716
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Mon May 03, 2004 7:26 pm

Ok sorry!
So, try to use:

Code: Select all

switch($_POST['act'])
Instead of:

Code: Select all

switch($act)
Please read this post, so you can know what i´m talking about!

In the code above, use $_GET / $_POST, depending on your form method, when submiting data via form. Otherwise use $_GET or $_REQUEST!
Sincerely,
Gonçalo "gesf" Fontoura

gesf.org | sessionstart.com | urlms.com

User avatar
gesf
Moderator
Moderator
Posts: 1716
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Tue May 04, 2004 8:44 am

No, it has nothing to do with the php.ini or even your OS.
There´re just a few things you should change.

1st:

Code: Select all

Replace you 1st if statement with:

if(isset($_POST['submit']))

// removed the ! (NOT)


2nd:

Code: Select all

You´re assigning your error message to a session variable, so that you better register it first, like:

session_start();
session_register('error');


3rd:

Code: Select all

Replace your code:

// Here, you´re print an Undefined variable: error!
if(!empty($_SESSION['error'])) echo $error;

With:

if(!empty($_SESSION['error'])) echo $_SESSION['error'];

It should work!
Anyway, i think there´s no need for using sessions here. You can simply assign the error message to a variable and print it, like:

Code: Select all

$error = '<strong>You must enter all information</strong>';

...

if(!empty($error)) echo $error;


Greetz,
gesf
Sincerely,
Gonçalo "gesf" Fontoura

gesf.org | sessionstart.com | urlms.com

User avatar
gesf
Moderator
Moderator
Posts: 1716
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Wed May 05, 2004 4:20 am

Yeh, there´re are some, or even a lot of little differences between PHP 4.3.3 and PHP 4.3.6.
Don´t ask me what are the differences, i really don´t know, but let´s say... in some functions. You´ll probably find some of them when working with more php's functions. But forget, they aren´t in statements like switch´s or if´s...

Well, about your switch problem, let´s say you´re looking for this: act=view&PkId=1 and you´re only cheking for act=view!

You can make something like (example):

Code: Select all

<?php
...

switch($_GET['act']) {

$PkId = $_GET['PkId'];

case "view":

/* And sending your 2nd variable as a parameter of your view_Selection() function */

view_Selection($PkId);

break;

...

?>
Sincerely,
Gonçalo "gesf" Fontoura

gesf.org | sessionstart.com | urlms.com

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest