PHP : How to post form data via another file?
form-submit, forms, php, post, submit
Solution
change your line in form.php
<form method="post" name="myform" action="form.php">
or
<form method="post" name="myform" action="index.php?act=form">
Problem
I have 2 files : index.php, form.php. form.php: ``` <?php if (isset($_POST['submit'])){ echo "OK"; // do something with post data } ?> <form method="post" name="myform"> <input type="text" name="name" /> <input type="submit" name="submit" value="SUBMIT" /> </form> ``` I call form.php by typing in browser address bar: `**`mysite/index.php?act=form`**` In index.php I have these line: ``` <?php switch($_REQUEST['act']){ case "form": include("form.php"); break; } ... ``` But I had nothing (in form.php) when the form was submitted. All that I want is get posted data in form.php, not in index.php. What was I wrong here? Thansk for your time!