Reputation:
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%20Mamgai
bit from the address bar?
Upvotes: 0
Views: 8013
Reputation: 338138
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;
?>
Upvotes: 7