TransWikia.com

How to post data to web page form and get response using php

Stack Overflow Asked by Abdulrahman Mohamed on January 6, 2021

<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

One Answer

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.

Answered by Bernhard on January 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP