Canman2005 Posted March 6, 2006 Share Posted March 6, 2006 Hi allHas anyone ever run into problems using the action query such as[code]if ($action == "delete" && $id != ""){[/code]For some reason the web server I am using doesnt understand what the action is and simply ignores it, executing the first sql statement it can find on the page.Any ideas would be great.ThanksEd Quote Link to comment https://forums.phpfreaks.com/topic/4260-if-action/ Share on other sites More sharing options...
Gaia Posted March 6, 2006 Share Posted March 6, 2006 Where are you getting the value of $action from? Quote Link to comment https://forums.phpfreaks.com/topic/4260-if-action/#findComment-14806 Share on other sites More sharing options...
Canman2005 Posted March 6, 2006 Author Share Posted March 6, 2006 [!--quoteo(post=352251:date=Mar 6 2006, 09:52 PM:name=Gaia)--][div class=\'quotetop\']QUOTE(Gaia @ Mar 6 2006, 09:52 PM) [snapback]352251[/snapback][/div][div class=\'quotemain\'][!--quotec--]Where are you getting the value of $action from?[/quote]Via the form, so the form action might look like<form id="form" method="post" action="page.php?action=delete"> Quote Link to comment https://forums.phpfreaks.com/topic/4260-if-action/#findComment-14808 Share on other sites More sharing options...
Gaia Posted March 6, 2006 Share Posted March 6, 2006 You'll still have to store the value into the variable.[code]$action = $_GET['action'];[/code] Quote Link to comment https://forums.phpfreaks.com/topic/4260-if-action/#findComment-14809 Share on other sites More sharing options...
kenrbnsn Posted March 6, 2006 Share Posted March 6, 2006 For this case you would need to use "$_POST['action']"This has all of the standard problems that indicate that this is a gregister_globals enabled vs. disabled problem.You should always program your scripts assuming that [a href=\"http://www.php.net/register_globals\" target=\"_blank\"]register_globals[/a] is disabled.Ken Quote Link to comment https://forums.phpfreaks.com/topic/4260-if-action/#findComment-14846 Share on other sites More sharing options...
Gaia Posted March 6, 2006 Share Posted March 6, 2006 Are you sure?page.php?action=delete is the form action, meaning it will go to that url correct?So, wouldn't you just have to check if ?action=delete is attached to the URL? Quote Link to comment https://forums.phpfreaks.com/topic/4260-if-action/#findComment-14854 Share on other sites More sharing options...
kenrbnsn Posted March 6, 2006 Share Posted March 6, 2006 Sorry, my mistake -- I saw the action="Post" not the hard coded URL in the action. Yes, $_GET is correct.Ken Quote Link to comment https://forums.phpfreaks.com/topic/4260-if-action/#findComment-14856 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.