nightfox1405241487 0 Report post Posted July 17, 2006 I've seen it in some other software but I forget where I saw it and how it was done other than this:In the HTML form:<form action="blah.php" method="post"><input type="hidden" name="action" value="login"><input.......So, would that submit to blah.php?action=login?Thanks,[N]F Share this post Link to post Share on other sites
Houdini 0 Report post Posted July 17, 2006 (edited) Well under normal circumstance the code you have would work, but as written the variable 'action' is a POST variable. so to pass the hidden field variable 'action' you would have to change your code to method-'get' like the below. <?php echo "<form action='blah.php' method='get'><input type='hidden' name='action' value='login'>";echo "<input type='submit'></form>";?>then use the following to access the variableblah.php<?php echo $_GET['action'];?>Does that help answer your question? Edited July 17, 2006 by Houdini (see edit history) Share this post Link to post Share on other sites
nightfox1405241487 0 Report post Posted July 18, 2006 Not really... I mean, from what I saw it was actually passing information through the POST method. I mean, I don't want to send sensitive information like passwords through GET. I wish I remember what it was that I saw using it... gosh darn it... grr... what was it called?!?[N]F Share this post Link to post Share on other sites
iGuest 3 Report post Posted July 18, 2006 If you've looked at AJAX it's possibly something you picked up there.Are you meaning that you want to send the information to blah.php?action=loginWhich means your form line would be like <form action="blah.php?action=login" method="post"> That way you're doing a get request with the action=login, and also posting data along with it to that URL.Other than this, we'd probably be stumped about what you're talking about.Cheers,MC Share this post Link to post Share on other sites
arukomp 0 Report post Posted September 17, 2006 Another example if you didn't understand: <form action="blah.php" action="POST"><input type="hidden" name="action" value="login"><input type="submit" name="submit" value="Go"></form><?phpif ($_GET['action'] == 'login') { // some code here....}else { // some other code here....}?> When you post something with form and with POST method, it's a good idea to use $_GET['string'] to get string values. Another example:<form action="login.php" action="POST"><input type="text" name="login"><input type="text" name="pass"><input type="submit" name="submit" value="Login"></form><?phpif ($submit) { // if form has been submited if ($_GET['login'] == $adminlogin) && $_GET['pass'] == $adminpass) { header("Location: adminpanel.php"); } else { header("Location: login.php"); }} Also, if you are posting data to the same page where form is, then you could use <?php $PHP_SELF ?> in "action" instead of "login.php".I hope this helped you a lot Share this post Link to post Share on other sites
Hercco 0 Report post Posted September 30, 2006 Nightfox, I think I know where you're coming from... You want to post both GET and POST data at once. Sounds pointless? Well it's not completely. I've used that method for pages that use a same PHP script to present all different pages, varying the content based on the GET variables. Sometimes it happens that you want to use a form on such page and sending it all through GET would get you really messy URLs and it could be that the information is delicate. On the otherhand using POST for everything would be inconvenient as user would not get a direct URL to the page and also because you'd might have to rewrite the page generating PHP script. Oh and it does work, juts put the GET variables in end of the URL in the action argument and use POST as the method. When you post something with form and with POST method, it's a good idea to use $_GET['string'] to get string values.What the...I hope this helped you a lot I'm most certain that it didnt. Share this post Link to post Share on other sites
minnieadkins 0 Report post Posted October 1, 2006 The action of your form can have a query string if you're using post.I.E. <form name="SomeForm" action="Action.php?page=mainā©=en" method="POST">Login:<input type="text" name="user" value="" />Password:<input type="text" name="pwd" value="" /></form> I'm not what sure you're trying to do, or what you're actually talking about. But I think that's something similiar. Don't forget that you can change the action of your form at any time with the DOM. document.forms[0].aciton='somaction.php?foo=bar'; Share this post Link to post Share on other sites
demolaynyc 0 Report post Posted January 9, 2007 There are various ways of going about this. One is to change "post" to "get" if you would like to place the variables next to the url. However, if you want to keep it hidden, use post and to retrieve the variables value from the next page you would have to use: <? $_POST[variablename] ?>Of course you replace "variablename" with your variable. Share this post Link to post Share on other sites