mikebyrne Posted March 10, 2009 Share Posted March 10, 2009 I am currently setting up a database and in one of the fields i want the user to only input one of 5 options (-,D,E,L,S) How do i format the field to allow these options in a drop down box? The field name is Vote with Varchar of length 5 Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted March 10, 2009 Share Posted March 10, 2009 Is this what you mean? <select name="Vote"> <option value="-">-</option> <option value="D">D</option> <option value="E">E</option> <option value="L">L</option> <option value="S">S</option> </select> Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 10, 2009 Author Share Posted March 10, 2009 Yeah that's exactly what I need but I'm using Navicat as a front end so Im not sure how to apply it Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 10, 2009 Author Share Posted March 10, 2009 The SQL for my table is CREATE TABLE `athy` ( `ID` decimal(10,0) NOT NULL, `Station` varchar(50) NOT NULL, `Sname` varchar(15) NOT NULL, `Fname` varchar(15) NOT NULL, `Address1` varchar(15) NOT NULL, `Address2` varchar(15) NOT NULL, `Address3` varchar(15) NOT NULL, `Address4` varchar(15) NOT NULL, `Vote` varchar(7) DEFAULT NULL, `Division` varchar(15) NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; How would I apply the options to "vote" Quote Link to comment Share on other sites More sharing options...
revraz Posted March 10, 2009 Share Posted March 10, 2009 The options are coded in something like PHP or ASP, not in Navicat. Not sure how you are using Navicat as a front end, isn't it just a DB Admin tool like PHPMYADMIN? Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 10, 2009 Author Share Posted March 10, 2009 Sorry I'm using Navicat as a DB tool not frontend I'm looking at PHPMYADMIN now but im still not sure how to apply the options Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted March 10, 2009 Share Posted March 10, 2009 I may be a little confused but by looking at your table wouldnt you just apply it like any other insert query like: <?php $vote = $_POST['Vote']; //Set the $vote variable equal to the option selected from the <select> box $query = "INSERT INTO table (vote) VALUES ('$vote')"; Ive never used navicat so is there something different to do? Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 10, 2009 Author Share Posted March 10, 2009 Im probably not making myslef clear (sorry!) Im setting up a DB and while im inputting the data I just want certain options in certain fields ie instead of manually typing either "Unknown, Dial, European, Post" i want a drop down menu to appear in the Vote field containing the above Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted March 10, 2009 Share Posted March 10, 2009 Ok, the dropdown menu I created should do this. What isnt it doing that it should be? Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 10, 2009 Author Share Posted March 10, 2009 I probably have to create an SQL statement as its the backend of the DB Quote Link to comment Share on other sites More sharing options...
revraz Posted March 10, 2009 Share Posted March 10, 2009 You are making yourself clear, but I don't think you are understanding our answers. Do you want to enter a ROW in the DB for each option? If so, just enter new rows with the data. Quote Link to comment 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.