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 1077667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:36:32+00:00 2026-05-16T21:36:32+00:00

my php: if(isset($_GET[‘text’])) { $text = $_GET[‘text’]; } else { $text = default; //if

  • 0

my php:

if(isset($_GET['text'])) {
 $text = $_GET['text'];
} else {
 $text = "default"; //if no ?text= set then print "default"
}

my .htaccess

RewriteEngine On
RewriteRule ^(.*)$ index.php?text=$1 [L,QSA]

the .htaccess works actually fine, except if i don’t set text to my url my else statement (“default”) doesn’t work.

so if enter mydomain.com/whatthe everything works fine ($text = “whatthe”;)
however when i just call mydomain.com $text is empty instead of cotaining “default”.

what do i wrong?

  • 1 1 Answer
  • 1 View
  • 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-05-16T21:36:33+00:00Added an answer on May 16, 2026 at 9:36 pm

    What is happening is that you are still setting the GET variable, albeit to null or an empty string.

    You should use:

    if(isset($_GET['text'] && !empty($_GET['text'])) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

.htaccess RewriteEngine On RewriteRule register index.php?mode=register RewriteRule login index.php?mode=login index.php <?php if ( isset
I use this code: <?php if(isset($_GET[hub_challenge])) { echo $_GET[hub_challenge]; } else { } $ch
<?php if (isset($_GET['action']) && (!$_GET['action'] == 'reply')) { ?> <div class=actions> <input type=button onclick=javascript:
I have the following PHP code: <?php if(isset($_GET['article'])) { echo <b>success</b>; } ?> And
I have the following pages: page1.php <?php if (isset($_GET['link'])) { session_start(); $_session['myvariable'] = 'Hello
topic.php $id = isset($_GET['id']) ? intval($_GET['id']) : 0; $query = mysql_query(SELECT * FROM topics
I am using this PHP code: if (isset($_GET['c'])) { $pages = array(home, upload, signup);
<?php if(isset($_POST['btnSubmit']) and $_GET['action'] == Add) { $Users->copyPostData(); $Users->_password(md5($_POST[password])); $Users->_status(0); $Users->_apikey(md5(ONE@:.$_POST[uname].:@STEP)); $userNum = $Users->checkUserExist($Users->_username());
i have a statement in my php: <? if(isset($_GET['mod']) && ($_GET['mod'] == category ||
I have written a simple code in page test_cookie.php to work with cookies. if(isset($_GET['data']))

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.