开发者

How to hide get and post parameters from the URL?

I have created a script that posts a value for a certain variable.

HTML:

<form action="post" action="func.php">
       <input name="name"></input>
</form>

func.php:

<?php
  $name = $_GET['name'];
  echo $name;
?>

Output:

Divya Mamgai

But when I check the URL in the address bar I see this:

http://.....func.php?name=Divya%20Mamgai

How can I remove that ?name=Divya%2开发者_StackOverflow0Mamgai bit from the address bar?


Set your form to method "post". This causes the form to transmit data to the server in the HTTP request body instead of using the URL.

<form action="func.php" method="post">
  <input name="name"></input>
</form>

And then use the $_POST superglobal in PHP:

<?php
  $name = $_POST['name'];
  echo $name;
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜