jmac1209 Posted November 28, 2011 Share Posted November 28, 2011 Hey, I'm new to php and I made a webpage that searches a text file and displays a list of courses I've taken depending on what you type into a textbox. I want to change it instead into two drop-down boxes (one for department one for semester) and a all button so that it's neater and to prevent errors. Here is what I have currently: http://codepad.org/nX6g9zh2 Please help! Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/251918-searching-a-txt-file-using-drop-boxes/ Share on other sites More sharing options...
ManiacDan Posted November 28, 2011 Share Posted November 28, 2011 You have to alter the <input> tags inside the <form> tag so that they're drop-downs. Once you have your two drop-downs you can alter the code you have that uses $_POST. If you don't know PHP this will be a lot more difficult. You may want to post in a subforum that will let you hire someone to make this change. Quote Link to comment https://forums.phpfreaks.com/topic/251918-searching-a-txt-file-using-drop-boxes/#findComment-1291689 Share on other sites More sharing options...
gerkintrigg Posted November 28, 2011 Share Posted November 28, 2011 it should be pretty simple to do. Have a look on W3Schools (Google it... W3 Schools) but to be honest, I may be confusing a simple question... but I'm not sure I really know what the problem is. Is it just a case of the options needing to be in a select command? the neatest way of doing it might be to use an array in the PHP, but it sounds like this might be a HTML issue rather than a PHP one. Quote Link to comment https://forums.phpfreaks.com/topic/251918-searching-a-txt-file-using-drop-boxes/#findComment-1291690 Share on other sites More sharing options...
jmac1209 Posted November 28, 2011 Author Share Posted November 28, 2011 How do I alter the POST function so that when I pass it through the FOR IF statement at the bottom it still reads correctly? Do I give the form a name and then put that as the POST? I'm sorry but I'm so confused on how to do this without adding significantly too the program. Here are my dropdown boxes currently: <h3> View a list of courses I've taken by:</h3> <!-- Drop Down list --> <p></p> <label>Filter by Semester:</label> <select name="semester" id="semester" size="1"> <option value="none" selected="selected"> Select Semester</option> <option value="Fall2008"> Fall 2008</option> <option value="Spring2009"> Spring 2009</option> <option value="Summer2009"> Summer 2009</option> <option value="Fall2009"> Fall 2009</option> <option value="Spring2010"> Spring 2010</option> <option value="Fall2010"> Fall 2010</option> <option value="Spring2011"> Spring 2011</option> <option value="Summer2011"> Summer 2011</option> <option value="Fall2011"> Fall 2011 </option> </select> <input type="button" id="semesterbutton" value="Select" /> <p></p> <!-- Drop Down List --> <label>Filter by Department:</label> <select name="department" id = "department" size="1"> <option value="none" selected="selected"> Select Department</option> <option value="ACC"> Accounting</option> <option value="BIO"> Biology</option> <option value="CHE"> Chemistry</option> <option value="CRM"> Crimionology</option> <option value="ECO"> Economics</option> <option value="EDU"> Education</option> <option value="ENG"> English</option> <option value="FIN"> Finance</option> <option value="GIS"> Global Issues</option> <option value="GTW"> Gateways</option> <option value="HIS"> History</option> <option value="ITM"> Information Technology</option> <option value="MAT"> Math</option> <option value="MGT"> Management</option> <option value="MKT"> Marketing</option> <option value="PHL"> Philosophy</option> <option value="SPE"> Speech</option> </select> <input type="button" id="departmentbutton" value="Select" /> <p> </p> <!-- View All Button --> <input type="button" value="View All" name ="viewall" /> Quote Link to comment https://forums.phpfreaks.com/topic/251918-searching-a-txt-file-using-drop-boxes/#findComment-1291695 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.