trueimage Posted December 4, 2006 Share Posted December 4, 2006 Here is a sample of my table:[table][tr][td][b]id[/b][/td][td][b]name[/b][/td][td][b]type[/b][/td][td][b]desc[/b][/td][/tr][tr][td]0[/td][td]apple[/td][td]mcintosh[/td][td]blah[/td][/tr][tr][td]1[/td][td]apple[/td][td]granny smith[/td][td]blah2[/td][/tr][tr][td]2[/td][td]apple[/td][td]red delicious[/td][td]blah[/td][/tr][tr][td]3[/td][td]orange[/td][td]florida[/td][td]blah3[/td][/tr][tr][td]4[/td][td]pear[/td][td]bartlett[/td][td]blah2[/td][/tr][tr][td]5[/td][td]apple[/td][td]mcintosh[/td][td]blah2[/td][/tr][/table]I want to have an input feature on the website so users can submit info. But i don't want them typing apple, Apple, appel, aplep, APPLE, etc for "apple". I want to have a drop down menu to choose what is available (for some fields, not all)Also, I'd like to have it setup so when you choose apple in the first drop down, mcintosh, granny smith, red delicious are the only 3 options in there. I don't know how to set this up in the database either, for reading this info.Basically it is like Auto Filter in Excel.So, some fields will be drop down only, some you can type in (ie the [b]desc[/b] field in this example) and some will have many options, but only display those contingent upon what is chosen in the previous, or specific drop down (ie [b]type[/b] choices depend upon what is chosen initially in the [b]name[/b] drop down). Also the fields that you can type in are to be limited to specific contents and limits (ie 0-9, length of 6 or alpha-numeric length of 30, etc)How difficult is this task? I have enough programming and php specific knowledge to figure out most of the code, but I have no clue on database stuff at all. I may consider a paid job depending on the complexity (feel free to PM/email me with offers if you think this will be easy for you to setup and me to maintain)Thanks! Link to comment https://forums.phpfreaks.com/topic/29444-php-mysql-to-create-this-functionality/ Share on other sites More sharing options...
AV1611 Posted December 4, 2006 Share Posted December 4, 2006 You can do linked pulldowns. I use them all the time...an example would be if you are from the US and you get all the states, but if you are in Canada, you get all the provices or whatever they call them. etc...You have to have some criteria in the table so you can limit which ones show.For example, I have the whole Bible on a web site. When you tell it what Book, it checks for how many chapters in that book, and puts it in a pull down, then when you select which chapter it looks at how many verses in that chapter, and displays that in a pulldown.here is a code sample: <td align="center"> <select name='BOOK' onchange="document.forms['book'].submit()"> <option> SELECT </option><?php $result = mysql_query("SELECT DiSTINCT BOOK FROM BIBLE "); IF ($row=mysql_fetch_array($result)) {do { $BOOK=$row["BOOK"]; echo "<OPTION>$BOOK</OPTION>"; } while($row = mysql_fetch_array($result)); echo "</SELECT>"; } Link to comment https://forums.phpfreaks.com/topic/29444-php-mysql-to-create-this-functionality/#findComment-135106 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.