Results 1 to 5 of 5

Thread: PHP Keeping URL the same.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    208

    PHP Keeping URL the same.

    <FORM METHOD=POST ACTION="YAY.php" ACTION="index.php">
    <CENTER><INPUT NAME="Register" VALUE="YAY" TYPE="submit"></CENTER>
    </FORM>

    when you click on yay the url turns from :

    www.site.com/index.php

    into www.site.com/YAY.php

    how can i keep the url www.site.com/index.php BUT change the page into YAY.php

    Thank you.

  2. #2
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: PHP Keeping URL the same.

    you are going to want to check to see if the page has been submited or not:

    PHP Code:
    if ($_POST['Register'] == "YAY") {
         
    //WHAT YOU WANT HERE

    but if you are looking for something like "index.php?page=mypage". then you can use a switch:

    PHP Code:
    switch ($_POST['page']) {
         case 
    "register":
              include(
    "register.php");
              break;
         default:
              include(
    "main.php");
              break;

    My usual boring signature: Something

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: PHP Keeping URL the same.

    You'd use header() for that but you're simply submitting a form to yay.php, which is why you can't "keep" the URL the same. If you must, then you can include that php file in the current php file, but make sure you remove the other bits.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    208

    Re: PHP Keeping URL the same.

    i dont understand a single thing...

  5. #5
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: PHP Keeping URL the same.

    can you expand more on what you want? Both me and mendhak gave good clear examples.
    My usual boring signature: Something

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width