plodos Posted December 26, 2008 Share Posted December 26, 2008 If I POST variable with this method, where like = '%%' query is not working <?php $var = $_POST['search']; but if I post with like that where like = '%%' query is working (somebody give me this code) <?php $search = (isset($_POST['search'])) ? $_POST['search'] : $_GET['search']; $search = trim(mysql_real_escape_string($search)); ?> What is the meaning of this sentence ??? <?php (isset($_POST['search'])) ? $_POST['search'] : $_GET['search']; ?> and what is the difference between these methods? Link to comment https://forums.phpfreaks.com/topic/138426-solved-i-need-simple-information-about-post-methods/ Share on other sites More sharing options...
PcGeniusProductions Posted December 26, 2008 Share Posted December 26, 2008 Hi. I am no expert, but I learned a fair bit from these pages. http://www.w3schools.com/php/php_post.asp http://www.tizag.com/phpT/postget.php I hope these help. Link to comment https://forums.phpfreaks.com/topic/138426-solved-i-need-simple-information-about-post-methods/#findComment-723765 Share on other sites More sharing options...
redarrow Posted December 26, 2008 Share Posted December 26, 2008 If post[''] never worked,then get[''] did, meaning your getting the search info from a url. if u need a brake down, off your code, and don't understand, then tell me then we will explain. Link to comment https://forums.phpfreaks.com/topic/138426-solved-i-need-simple-information-about-post-methods/#findComment-723769 Share on other sites More sharing options...
plodos Posted December 26, 2008 Author Share Posted December 26, 2008 Thanks for urgent reply. Could you explain this code word by word, what does it stand for ( ? : ) <?php (isset($_POST['search'])) ? $_POST['search'] : $_GET['search']; ?> Link to comment https://forums.phpfreaks.com/topic/138426-solved-i-need-simple-information-about-post-methods/#findComment-723771 Share on other sites More sharing options...
Mikedean Posted December 26, 2008 Share Posted December 26, 2008 <?php (isset($_POST['search'])) ? $_POST['search'] : $_GET['search']; ?> It's an IF statement (I can't remember what it's called), so it checks if '$_POST['search']' is set, if it is, then it sets '$search' to $_POST['search'], if not then it sets it to $_GET['search']. It's just like using IF (BLAH) { } else {} but it's a lot cleaner . Hope this helps . Link to comment https://forums.phpfreaks.com/topic/138426-solved-i-need-simple-information-about-post-methods/#findComment-723773 Share on other sites More sharing options...
plodos Posted December 26, 2008 Author Share Posted December 26, 2008 Thanks for everything. Link to comment https://forums.phpfreaks.com/topic/138426-solved-i-need-simple-information-about-post-methods/#findComment-723774 Share on other sites More sharing options...
MatthewJ Posted December 26, 2008 Share Posted December 26, 2008 It is called a ternary operation Link to comment https://forums.phpfreaks.com/topic/138426-solved-i-need-simple-information-about-post-methods/#findComment-723775 Share on other sites More sharing options...
plodos Posted December 26, 2008 Author Share Posted December 26, 2008 im going to search "ternary operation" methods now. thank you one more time Link to comment https://forums.phpfreaks.com/topic/138426-solved-i-need-simple-information-about-post-methods/#findComment-723781 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.