opstabom Posted October 14, 2008 Share Posted October 14, 2008 I have form <form action="http://host/login/" method="post"> <input type="text" name="username"> <input type="submit" name="submit" value="Login"> </form> When I use GET variables than variables are set but when I use POST $_POST array are empty .What is wrong. ??? Link to comment https://forums.phpfreaks.com/topic/128354-problem-post-variable/ Share on other sites More sharing options...
Bendude14 Posted October 14, 2008 Share Posted October 14, 2008 your not defining a file to handle the form? Unless there is a file called index.php in the login directory? show us how you are trying to retrieve vars out of the POST array? below code should work handle.php <?php if(isset($_POST['submit'])) { $name = $_POST['username']; ?> form.php <form action="handle.php" method="post"> <input type="text" name="username"> <input type="submit" name="submit" value="Login"> </form> Put both files in the same directory and see if it works... Link to comment https://forums.phpfreaks.com/topic/128354-problem-post-variable/#findComment-664880 Share on other sites More sharing options...
opstabom Posted October 14, 2008 Author Share Posted October 14, 2008 I use route to index.php and all requests are routed to Controller. for now AccountController Link to comment https://forums.phpfreaks.com/topic/128354-problem-post-variable/#findComment-664886 Share on other sites More sharing options...
Bendude14 Posted October 14, 2008 Share Posted October 14, 2008 you should have probably mentioned that when you posted. Show me what you already have? if what you posted first is it then obviously a problem with the route? Link to comment https://forums.phpfreaks.com/topic/128354-problem-post-variable/#findComment-664889 Share on other sites More sharing options...
opstabom Posted October 14, 2008 Author Share Posted October 14, 2008 I posted for example admin and POST array is empty when I use POST and GET array is empty when I use Get method. No I just copy and paste from my old projects and there all worked fine I don't now where is problem.I copy and paste this form to simple script and all functions fine. Link to comment https://forums.phpfreaks.com/topic/128354-problem-post-variable/#findComment-664892 Share on other sites More sharing options...
Bendude14 Posted October 14, 2008 Share Posted October 14, 2008 so do you still have a problem? Can you sure your whole code because i don't really understand what the problem is apart from the POST and GET arrays are empty. And in the example i gave you which is similar to what you posted does that work fine? Link to comment https://forums.phpfreaks.com/topic/128354-problem-post-variable/#findComment-664901 Share on other sites More sharing options...
opstabom Posted October 14, 2008 Author Share Posted October 14, 2008 Yes this form works fine. Link to comment https://forums.phpfreaks.com/topic/128354-problem-post-variable/#findComment-664904 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.