0
<form method="post" action="">
<input type="text" class="form-control" name="name" placeholder="some name">
<input type="text" class="form-control" name="code" placeholder="123456">
<input type="submit" class="btn btn-info" value="Submit" name="submit" />
</form>
<br>

<?php
//submit data

if (isset($_POST['submit'])) {
 
echo $_POST['name']."<br/>";
echo $_POST['code']."<br/>";

}



?>

that was my index.php and i want to post data into this form from another web page and get response by using php

  • Does this answer your question? [How do I send a POST request with PHP?](https://stackoverflow.com/questions/5647461/how-do-i-send-a-post-request-with-php) – Abcd Efg Jul 21 '20 at 20:05

1 Answers1

0

Set the action-attribute to anotherwebpage.php and catch the values with the $_POST-Variables. So you basically move your PHP-block to anotherwebpage.php.

Bernhard
  • 1,852
  • 11
  • 19