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.
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;
}
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.
Re: PHP Keeping URL the same.
i dont understand a single thing...
Re: PHP Keeping URL the same.
can you expand more on what you want? Both me and mendhak gave good clear examples.