brincobb Posted October 25, 2013 Share Posted October 25, 2013 Here' my html code <tr> <td class="easdwnunder" style="width: 40%;">DATE OF BIRTH:</td> <td class="dwnunder2" style="width: 40%;"><div style="width: 100%;"> <?php if($newproblem && !$printing) { ?> <?php echo date_dropdown($this->row->date_of_birth); ?> <?php } else { echo safe_out($this->row->date_of_birth); } ?> </div></td> </tr> And here's my dropdown function function date_dropdown($year_limit = 0) { $html_output = ' <div id="date_select" >'."\n"; $html_output .= ' <label for="date_day"></label>'."\n"; /*days*/ $html_output .= ' <select name="date_day" id="day_select">'."\n"; for ($day = 1; $day <= 31; $day++) { $html_output .= ' <option>' . $day . '</option>'."\n"; } $html_output .= ' </select>'."\n"; /*months*/ $html_output .= ' <select name="date_month" id="month_select" >'."\n"; $months = array("", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); for ($month = 1; $month <= 12; $month++) { $html_output .= ' <option value="' . $month . '">' . $months[$month] . '</option>'."\n"; } $html_output .= ' </select>'."\n"; /*years*/ $html_output .= ' <select name="date_year" id="year_select">'."\n"; for ($year = 1900; $year <= (date("Y") - $year_limit); $year++) { $html_output .= ' <option>' . $year . '</option>'."\n"; } $html_output .= ' </select>'."\n"; $html_output .= ' </div>'."\n"; $date_of_birth = $day ."-". $month ."-". $year; return $html_output; } Quote Link to comment https://forums.phpfreaks.com/topic/283267-my-dropdown-date-of-birth-does-not-insert-to-db/ Share on other sites More sharing options...
mac_gyver Posted October 25, 2013 Share Posted October 25, 2013 My dropdown date of birth does not insert to db ummm. what INSERT statement? what db are you using? what have you done to pin down where your code and data are doing what you expect and where they are not? Quote Link to comment https://forums.phpfreaks.com/topic/283267-my-dropdown-date-of-birth-does-not-insert-to-db/#findComment-1455405 Share on other sites More sharing options...
brincobb Posted October 28, 2013 Author Share Posted October 28, 2013 im using mysql database and here are fields in the table. CREATE TABLE IF NOT EXISTS `cf360_wanted_persons_problems` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `uid` text NOT NULL, `rank` varchar(100) NOT NULL, `name` varchar(100) NOT NULL, `fstname` varchar(100) NOT NULL, `alias` varchar(100) CHARACTER SET latin1 NOT NULL, `idno` varchar(100) NOT NULL, `case_no` varchar(100) CHARACTER SET latin1 NOT NULL, `aquisition_request` varchar(100) CHARACTER SET latin1 NOT NULL, `persal_no` varchar(255) CHARACTER SET latin1 NOT NULL, `division` varchar(255) CHARACTER SET latin1 NOT NULL, `stationname` varchar(100) NOT NULL, `stationadd` text NOT NULL, `physicaladd` text NOT NULL, `postalcode` varchar(50) NOT NULL, `telecntct` varchar(100) NOT NULL, `fax` varchar(100) NOT NULL, `stationemail` varchar(100) NOT NULL, `emailaddress` varchar(100) NOT NULL, `afsbjct` varchar(100) NOT NULL, `ocomments` text NOT NULL, `datecaptured` datetime NOT NULL, `officialdate` datetime NOT NULL, `uemail` text NOT NULL, `ulocation` text NOT NULL, `uphone` text NOT NULL, `rep` bigint(20) NOT NULL, `status` bigint(20) NOT NULL, `time_spent` bigint(20) NOT NULL, `category` bigint(20) NOT NULL, `close_date` datetime NOT NULL, `department` bigint(20) NOT NULL, `rdescription` bigint(20) NOT NULL, `offender_description` bigint(20) NOT NULL, `declaration_description` bigint(20) NOT NULL, `countries` bigint(20) NOT NULL, `provinces` bigint(20) NOT NULL, `title` text NOT NULL, `description` text NOT NULL, `crime_description` text CHARACTER SET latin1 NOT NULL, `scars_remarks_description` text CHARACTER SET latin1 NOT NULL, `remarks_description` text CHARACTER SET latin1 NOT NULL, `caution_description` text CHARACTER SET latin1 NOT NULL, `statement_remarks_description` text CHARACTER SET latin1 NOT NULL, `reward` text CHARACTER SET latin1 NOT NULL, `place_of_birth` varchar(100) CHARACTER SET latin1 NOT NULL, `last_known_location` varchar(100) CHARACTER SET latin1 NOT NULL, `race` varchar(100) CHARACTER SET latin1 NOT NULL, `sex` varchar(100) CHARACTER SET latin1 NOT NULL, `eyes` varchar(100) CHARACTER SET latin1 NOT NULL, `hair` varchar(100) CHARACTER SET latin1 NOT NULL, `weight` bigint(20) NOT NULL, `height` bigint(20) NOT NULL, `build` varchar(100) CHARACTER SET latin1 NOT NULL, `solution` text NOT NULL, `start_date` datetime NOT NULL, `date_of_birth` varchar(100) NOT NULL, `crime_date` varchar(100) CHARACTER SET latin1 NOT NULL, `age` smallint(20) NOT NULL, `priority` bigint(20) NOT NULL, `entered_by` bigint(20) NOT NULL, `kb` bigint(20) NOT NULL, UNIQUE KEY `id` (`id`), KEY `rep` (`rep`,`status`,`category`,`department`,`priority`), FULLTEXT KEY `solution` (`solution`), FULLTEXT KEY `description` (`description`), FULLTEXT KEY `title` (`title`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=28 ; Here's the code to insert. <?php defined('_JEXEC') or die('Restricted access'); //check user auth level require_once JPATH_COMPONENT.DS.'helpers'.DS.'head.php'; require_once JPATH_COMPONENT.DS.'helpers'.DS.'auth.php'; $mainframe = &JFactory::getApplication(); if(!checkusermin('user') && !config('allowanonymous')) $mainframe->redirect('index.php', JText::_('ALERTNOTAUTH')); /* NOTE: If we make any changes to this class, we need to make similar changes to helpers/imap.php because the class is duplicated there. */ class TableDetail extends JTable { var $id = null; var $uid = null; var $uemail = null; var $ulocation = null; var $uphone = null; var $rep = null; /*########################*/ var $name = null; var $fstname = null; var $case_no = null; var $alias = null; var $idno = null; var $rank = null; var $fax = null; //var $countries = null; var $stationemail = null; var $stationname = null; var $stationadd = null; var $physicaladd = null; var $postalcode = null; var $telecntct = null; var $emailaddress = null; var $afsbjct = null; var $ocomments = null; var $datecaptured = null; var $officialdate = null; /*########################*/ var $status = null; var $time_spent = null; var $category = null; var $close_date = null; var $department = null; var $countries = null; var $date_of_birth = null; var $missing_date = null; var $success_date = null; var $place_of_birth = null; var $last_known_location = null; var $race = null; var $sex = null; var $eyes = null; var $hair = null; var $weight = null; var $height = null; var $build = null; var $title = null; var $description = null; var $crime_description = null; var $scars_remarks_description = null; var $remarks_description = null; var $caution_description = null; var $statement_remarks_description = null; var $reward = null; var $solution = null; var $start_date = null; var $priority = null; var $entered_by = null; var $kb = null; function __construct(&$db) { parent::__construct('#__wanted_persons_problems','id',$db); } } Quote Link to comment https://forums.phpfreaks.com/topic/283267-my-dropdown-date-of-birth-does-not-insert-to-db/#findComment-1455817 Share on other sites More sharing options...
mac_gyver Posted October 28, 2013 Share Posted October 28, 2013 nothing you have posted in this thread shows the code where the problem might be. the first post was for your dropdown. the second post shows some very old code for the start of a class. just exactly what sort of help were you expecting to get? Quote Link to comment https://forums.phpfreaks.com/topic/283267-my-dropdown-date-of-birth-does-not-insert-to-db/#findComment-1455853 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.