Jump to content

Searching a .txt file using drop boxes?


jmac1209

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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" />

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.