?action=...

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
ben-l
-


Joined: 22 Apr 2003
Posts: 2

PostPosted: Tue Apr 22, 2003 9:36 pm    Post subject: ?action=... Reply with quote

Hi

When i try to open my homepage wih index.php?action=news it doesn't work properly. It acts as if action was set to nothing! When i opened the page on tripod, everything worked properly and it showed the news.

I installed php 4.3.1; I set register_globals = Off to register_globals = On and did everything the php tutorial says, but it still opens the main page and not the news, as it should

where's the mistake?

here's the script:

Code:

<?php
if(!isset($action))
{
include("home.html");
}
else
{
if(file_exists("$action.html"))
{
include("$_action.html");
}
}
?>
Back to top View user's profile Send private message
Omar G
-


Joined: 21 Mar 2003
Posts: 34
Location: Honolulu, Hawai'i

PostPosted: Tue Apr 22, 2003 11:41 pm    Post subject: Reply with quote

Hi!

Despite having register_globals = On, it may be better anyway to write $_REQUEST['action'] or even $GLOBALS['action'].
$_GET['action'] wil be foolproof, but will not catch form posts; use $_POST['action'] for that. $_REQUEST will catch them both, fom either a URL or form post.

- Omar G
Back to top View user's profile Send private message
ben-l
-


Joined: 22 Apr 2003
Posts: 2

PostPosted: Wed Apr 23, 2003 8:23 am    Post subject: Reply with quote

ah thanks!

everything works now :D
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group