Results 1 to 1 of 1
  1. #1
    Join Date
    Mar 2003
    Posts
    225

    Unanswered: changing text fields to drop downs

    I have spent absolutely weeks playing around with this but cant get it to work no matter what.

    I am trying to change a couple of fields in my php page from a text box to a drop down box.

    Fields i am trying to change on my form are:

    Php form name ----- Mysql store name

    Beds ----- Bed
    Bathroom ----- Bath
    Year ----- Year
    Local Authority----- Subdiv
    Local Hospital ----- Schoold
    Grounds Acres ----- lot_size
    Sqfeet ----- sqft

    I store the values of the drop down box in my mysql table

    Table structure is as follows:

    Code:
    CREATE TABLE `categories` (
      `id` int(11) NOT NULL auto_increment,
      `title` varchar(50) default NULL,
      `description` text,
      `image` varchar(50) default NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=23 ;
    
    -- 
    -- Dumping data for table `categories`
    -- 
    
    INSERT INTO `categories` VALUES (14, 'Yes', '-', '');
    INSERT INTO `categories` VALUES (15, 'No', '-', '');
    so in this case you can see I am just trying to use a yes or no value.

    I want to store this in my table as a number

    I already use the results from the drop down options in another field but cant seem to get this duplicated for my other fields.

    my database store structure is as follows

    Code:
    CREATE TABLE `items` (
      `id` int(11) NOT NULL auto_increment,
      `cid` int(11) default NULL,
      `scid` int(11) default NULL,
      `mid` int(11) default NULL,
      `title` varchar(50) default NULL,
      `price` double default NULL,
      `special_price` double default NULL,
      `pdate` datetime default NULL,
      `sold` varchar(4) default NULL,
      `description` text,
      `address` varchar(50) default NULL,
      `city` varchar(45) default NULL,
      `state` varchar(45) default NULL,
      `zip` varchar(50) default NULL,
      `exp` int(11) default NULL,
      `featured` varchar(4) default NULL,
      `active` varchar(5) default NULL,
      `hits` int(11) default NULL,
      `bed` int(11) default NULL,
      `bath` int(11) default NULL,
      `subdiv` int(11) default NULL,
      `schoold` int(11) default NULL,
      `year` int(11) default NULL,
      `lot_size` int(11) default NULL,
      `sqft` int(11) default NULL,
      `lat` varchar(40) default NULL,
      `long` varchar(40) default NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;
    I want my php code to be able to update the database using only yes or no values from my categories field…

    Please help i am going nuts with this

    my php file is attached
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •