[Solved] $_SERVER[‘PHP_SELF’] not working [closed]
Im sorry if this kind of question has been asked before. but i spent much time searching for but I could not find the solution. so i’m posting here..
I’m trying to post the values onto the same page(working with Jquery mobile UI). so I’m using $_SERVER[‘PHP_SELF’] in action for my form in the page. Please check the spelling for action(working for actoin but not for action)
when i’m using this its posting in the same page and i’m happy
<form method="POST" actoin="echo $_SERVER['PHP_SELF']; ">
Please check the spelling for action
when I’m using this
<form method="POST" action="<?php echo $_SERVER['PHP_SELF'];?>">
Its pointing to index.php of my application.
can anyone please tell me..why its happening like this..please note that I know that its typo..
The problem is
$_SERVER['PHP_SELF'] returns the name of script. You probably mean
$_SERVER['REQUEST_URI']. It is working with
actoin because most of browsers will submit it to the same page when there is no
action not actoin , and you can simply write
without action and it will post values on the same page