astani Posted September 22, 2008 Share Posted September 22, 2008 This code gives me an error on the first line. I am trying to pass in an html option value from the html dropdown box. Help please... if ($_REQUEST['<'OPTION value=.$value.>] == "0") { $sort_query = pg_query("SELECT * FROM projects ORDER BY title"); $projByTitle = pg_fetch_array($sort_query); } else { $sort_query = pg_query("SELECT * FROM projects ORDER BY username"); $projByOwner = pg_fetch_array($sort_query); } Quote Link to comment https://forums.phpfreaks.com/topic/125345-php-sorting-with-dropdown/ Share on other sites More sharing options...
Maq Posted September 22, 2008 Share Posted September 22, 2008 if ($_REQUEST[''] == "0") { That's not a valid name for a request. Look how many single quotes you have. You're giving it an HTML option input name. What are you trying to pass through? Could you post the code where you're trying to get your values from? Quote Link to comment https://forums.phpfreaks.com/topic/125345-php-sorting-with-dropdown/#findComment-647880 Share on other sites More sharing options...
astani Posted September 22, 2008 Author Share Posted September 22, 2008 Here is the html code: <html> <form> <select name="Sort" > <option value="0" selected = "selected">By Name</option> <option value="1" >By Owner</option> </select> <form id="sort1" action="sort1.php" method="post" name= "sort"> <input type="hidden" name="id" value="<? echo '<OPTION value='.$value.'> '.$value.'' ?>" /> <input type="submit" id="submit" name="submit" value ="submit"/> </form> </html> That's not a valid name for a request. Look how many single quotes you have. You're giving it an HTML option input name. What are you trying to pass through? Could you post the code where you're trying to get your values from? Quote Link to comment https://forums.phpfreaks.com/topic/125345-php-sorting-with-dropdown/#findComment-647884 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.