Freedom-n-Democrazy Posted September 30, 2011 Share Posted September 30, 2011 Is it possible to redefine a $_POST after PHP has received the value of it via a HTML form? Something like this: if ($_POST['category'] == "Belts") { $_POST['category'] = "belts"; } Quote Link to comment https://forums.phpfreaks.com/topic/248154-redefining-_post/ Share on other sites More sharing options...
Freedom-n-Democrazy Posted September 30, 2011 Author Share Posted September 30, 2011 That code actually looks valid. I suspect the problem lays else where. I will report back. Quote Link to comment https://forums.phpfreaks.com/topic/248154-redefining-_post/#findComment-1274269 Share on other sites More sharing options...
Freedom-n-Democrazy Posted September 30, 2011 Author Share Posted September 30, 2011 Everything looks fine. If it can be done, then there is defiantly a problem with my code. Can someone correct it for me? I'm out of ideas. Quote Link to comment https://forums.phpfreaks.com/topic/248154-redefining-_post/#findComment-1274273 Share on other sites More sharing options...
Pikachu2000 Posted September 30, 2011 Share Posted September 30, 2011 What makes you think there's a problem with it? Quote Link to comment https://forums.phpfreaks.com/topic/248154-redefining-_post/#findComment-1274275 Share on other sites More sharing options...
Buddski Posted September 30, 2011 Share Posted September 30, 2011 You can modify $_POST data in PHP, if you couldnt we would all be in a world of trouble. The code you provided is valid, assuming that $_POST['category'] exists. The problem must lie elsewhere. Quote Link to comment https://forums.phpfreaks.com/topic/248154-redefining-_post/#findComment-1274276 Share on other sites More sharing options...
Freedom-n-Democrazy Posted September 30, 2011 Author Share Posted September 30, 2011 Thank you very much! Thats allot of relief. My biggest scare of PHP is "Can it be done?". Yes, there must be a problem else where. I am confident I will find it. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/248154-redefining-_post/#findComment-1274279 Share on other sites More sharing options...
Freedom-n-Democrazy Posted September 30, 2011 Author Share Posted September 30, 2011 I am pretty sure this is the issue. Does this look wrong? I see an aweful lot of quotation marks. $query = "select * from products where category = ".$_POST['category'].""; Quote Link to comment https://forums.phpfreaks.com/topic/248154-redefining-_post/#findComment-1274282 Share on other sites More sharing options...
Buddski Posted September 30, 2011 Share Posted September 30, 2011 From your previous posts, $_POST['category'] is a string and needs to be enclosed in quotes in the query. $query = "select * from products where category = '".$_POST['category']."'"; Quote Link to comment https://forums.phpfreaks.com/topic/248154-redefining-_post/#findComment-1274283 Share on other sites More sharing options...
Freedom-n-Democrazy Posted September 30, 2011 Author Share Posted September 30, 2011 bloody hell you beat me too it! LOL Thanks but Quote Link to comment https://forums.phpfreaks.com/topic/248154-redefining-_post/#findComment-1274284 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.