Jump to content

[SOLVED] Mysql dropdown option in field


mikebyrne

Recommended Posts

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"

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?

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 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.