Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7912707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:40:32+00:00 2026-06-03T13:40:32+00:00

I just transferred a PHP website from a Linux server to Windows. Everything seems

  • 0

I just transferred a PHP website from a Linux server to Windows. Everything seems to function the same except one huge difference:

On the Linux server, the following piece of code is ignored when $_GET['action'] is not set:

$action = $_GET['action'];
if($action=='add'){
    echo 'good';
}

However, this prevents the page from loading on the Windows server.

What does work is:

if(isset($_GET['action'])){
    $action = $_GET['action'];
}else{
    $action='';
}

if($action=='add'){
    echo 'good';
}

2 questions:

  1. Is there a way to configure the server to be more forgiving of variables that don’t have a value?

  2. Is the second code example better practice?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:40:33+00:00Added an answer on June 3, 2026 at 1:40 pm
    Is there a way to configure the server to be more forgiving of variables that don't have a value?
    

    putting an @ symbol infront of the variable will tell php to ignore the error. but i consider this as bad practice.

    Is the second code example better practice?
    

    i do consider it as a good practice, it is always good to check.

    IMO you should go for second, you can always use a ternary operator. so instead of

    if(isset($_GET['action'])){
        $action = $_GET['action'];
    }else{
        $action='';
    }
    

    you can write

    $action = isset($_GET['action']) ? $_GET['action'] : '';
    

    both does the same thing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just transferred from a college to a university and it seems like everything
Recently I transferred a set of data from one server to hpcc(high-performance computing) Command
I just transferred my local web app to my server, and now I'm getting
(I have a Linux server and My computer's operating sysyem is Windows.) Hi. I've
I have transferred my WordPress blog from Godaddy to my own personal server and
I just installed Ubuntu 10.10 server with NodeJS 0.4.6 using this guide: http://www.codediesel.com/linux/installing-node-js-on-ubuntu-10-04/ on
Hello MODx developers, I am using MODx revolution. I have just transferred site from
I have just transferred my EF 4.0 Solution to use EF 4.1 Code-First. Everything
Just switched over from eclipse to vs 2008 for debugging javascript, i feel more
Just looking for a good PHP Image Library, I want to display images with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.