View Single Post
  #1 (permalink)  
Old Feb 8th, 2008, 19:32
saltedm8's Avatar
saltedm8 saltedm8 is online now
Lead Administrator

SuperMember
Join Date: Nov 2005
Location: Always About
Age: 27
Posts: 1,298
Blog Entries: 1
Thanks: 1
Thanked 6 Times in 6 Posts
[this.selectedIndex].value"> validate

i have this, but i am trying to get it to validate, i have solved most the errors but it is just one that is getting the better of me, here is the code

PHP: Select all

<?php

    
//get this month and year
    
$month date("n");
    
$year date("Y");
    
    
$jump = isset($_POST['jump']) ? $_POST['jump'] : (isset($_GET['jump']) ? $_GET['jump'] : $month);

    require(
'main.php');
    
    
$month_tots = array();
    for (
$i=1$i<=12$i++) $month_tots[$i] = 0;       // ensure total for every month

    
$res mysql_query ("SELECT MONTH(FROM_UNIXTIME(date)) as mth, COUNT(*) AS num 
                        FROM form
                        WHERE YEAR(FROM_UNIXTIME(date)) = '$year'
                        GROUP BY mth"
);
     while (list(
$mth$num) = mysql_fetch_row($res)) 
     {
         
$month_tots[$mth] = $num;         // put month totals in the array
     
}
     
     
/**
     * create the dropdown
     */
     
echo '<form method="post" action="" >
     <select name="jump" id="jump"  onchange="location.href=this.options[this.selectedIndex].value"> '
;
     foreach (
$month_tots as $m => $num)
     {
         
$sel $jump==$m 'selected="selected"':'';
         
$dt date ('F Y'mktime(0,0,0,$m1$year));
         echo 
"<option value='index.php?jump=$m' $sel>$dt ($num)</option>";
     }
     echo 
'</select></form>'?>
     
    <?php mysql_close($conn); ?>
this is the offending line
PHP: Select all

     <select name="jump" id="jump"  onchange="location.href=this.options[this.selectedIndex].value"> ; 

and this is the error

Quote:
line 44 column 99 - Error: document type does not allow element "select" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag
does anyone know how this can be fixed, thank you
__________________
My Recipe forum...don't click here
Reply With Quote