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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:31:18+00:00 2026-05-29T22:31:18+00:00

I have: <a href=index.php?mypage=one>one</a> And: <a href=index.php?mypage=two>two</a> PHP page: <?php if mypage=one then echo

  • 0

I have:

<a href="index.php?mypage=one">one</a>

And:

<a href="index.php?mypage=two">two</a>

PHP page:

<?php
if mypage=one then 
echo "my stuff text........one";

if mypage=two then
echo "my stuff text........two";
?>

I want to get text separately for each link from same php page

  • 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-05-29T22:31:19+00:00Added an answer on May 29, 2026 at 10:31 pm

    First of all, if then construct is not available in PHP so your code is syntactically wrong. The use of switch as suggested already is a good way to go. However, for your problem, you should use $_GET[‘mypage’] instead of $_POST[‘mypage’]. It seems you are beginning PHP. Once you get some good basics, you will probably be making use of the functions such as include() and require(). Make sure you do not make mistakes beginners do:

    <?php
    if (isset($_GET['mypage'])
    {
        @include($_GET['mypage']);
    }
    ?>
    

    The above code works and looks simple but it has a very dangerous implementation allowing the malicious users to perform an attack known as file inclusion attack. So you should try to use the switch statements such as:

    <?php
    $mypage = $_GET['mypage']; //also you might want to cleanup $mypage variable
    switch($mypage)
    {
        case "one":
            @include("one.php");
            break;
    
        case "two":
            @include("two.php");
            break;
    
        default:
            @include("404.php");
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, so I have let's say this page http://mypage.com/index.php?id=something . I want to have
I have index.php like this: <script type=text/javascript src=jquery-1.4.2.js></script> <script type=text/javascript src=ajax.js></script> <a href='one.php' class='ajax'>One</a>
I have the following url. http://127.0.0.1/ci/index.php/admin/menus/edit/24 I want to get 24 from this to
I have html which contains such text ....... <a class=product_name href=index.php?productID=29785>Funny</a> ........ <a class=product_name
I have 3 links on page index.php: <div id=languages> <a href=index.php?page=test&lang=en id=flag> <img src=./images/flags/en.png
I have a link with 'remove' anchor text with href something like below: ./index.php?del_id=5
I have some link with parameter: <a href=index.php?page=home&lang=en class=flag> <img src=./images/flags/en.png class=flag_on alt=en title=en>
is it possible to have <a href=index.php > click </a> that doesn't change page
I have a list, consisting of links looking like this: <a href=index.php?p=page_1>Page 1</a> <a
I have the following javascript into a index.php file: <script type=text/javascript> $('.showpics, .showpics2').live('click', function()

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.