1<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
2 Name: <input type="text" name="fname">
3 <input type="submit">
4</form>
5<?php
6if ($_SERVER["REQUEST_METHOD"] == "POST") {
7 // do logic
8 $name = $_POST['fname'];
9}
10?>
1$response = httpPost("http://mywebsite.com/update.php",
2 array("first_name"=>"Bob","last_name"=>"Dillon")
3);
4
5//using php curl (sudo apt-get install php-curl)
6function httpPost($url, $data){
7 $curl = curl_init($url);
8 curl_setopt($curl, CURLOPT_POST, true);
9 curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
10 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
11 $response = curl_exec($curl);
12 curl_close($curl);
13 return $response;
14}
1$data = json_decode(file_get_contents('php://input'), true);
2
3// you have all in an array
1<form action="/" method="get">
2 <input type="text" name="name">
3 <br>
4 <input type="submit">
5</form>
6<?php
7 echo $_GET["query"];
8?>
1<?php
2var = $_POST['var'];
3echo var;
4
5// YOUR METHOD IN HTML MUST BE IN POST
6
7<form method="post">
8 <input type="text" name="var">
9</form>