merrickdav Posted May 24, 2009 Share Posted May 24, 2009 This function dosen't work properly. Any clues? function makeSelect($name,$label,$options,$value='',$message='') { $this->count++; $html ="<div class ='selectRow'>"; $this->makeLabel($name, $label); $html.='<select id="'.$name. '"name="'.$name.'" tabindex= "'.$this->count.'" class ="selectBox">'; foreach($options as $optionValue=>$optionLabel){ $checked = $optionValue == $value ? " checked " : ""; $html.="<option value ='$optionValue' $checked>$optionLabel</option>"; } $html.="</select>"; $this->makeMessage($message); $html.="</div>" ; $this->html.= $html; } Associated Errors # Line 60, Column > 80: XML Parsing Error: attributes construct error …ltipart/form-data"><div class="boxa"><div class="label"><label for="name">You… ✉ # Error Line 60, Column > 80: XML Parsing Error: Couldn't find end of Start Tag select line 60 …ltipart/form-data"><div class="boxa"><div class="label"><label for="name">You… ✉ # Error Line 60, Column > 80: XML Parsing Error: Opening and ending tag mismatch: div line 60 and select …ltipart/form-data"><div class="boxa"><div class="label"><label for="name">You… ✉ # Error Line 60, Column > 80: XML Parsing Error: Opening and ending tag mismatch: form line 60 and div …ltipart/form-data"><div class="boxa"><div class="label"><label for="name">You… ✉ # Error Line 60, Column > 80: XML Parsing Error: Opening and ending tag mismatch: div line 52 and form …ltipart/form-data"><div class="boxa"><div class="label"><label for="name">You… ✉ # Error Line 88, Column 6: XML Parsing Error: Opening and ending tag mismatch: body line 24 and div </div> ✉ # Error Line 89, Column 7: XML Parsing Error: Opening and ending tag mismatch: html line 2 and body </body> Full code for page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Dave's Web Designs</title> <link rel="stylesheet" href="assets/css/blueprint/screen.css" type="text/css" media="screen, projection" /> <link rel="stylesheet" href="assets/css/blueprint/grid.css" type="text/css" media="screen, projection" /> <link rel="stylesheet" href="assets/css/blueprint/print.css" type="text/css" media="print" /> <!--[if IE 8]> <link href="assets/IE - 8 - specific.css" rel="stylesheet" type="text/css" /> <![endif]--> <!--[if IE 7]> <link href="assets/IE - 7 - specific.css" rel="stylesheet" type="text/css" /> <![endif]--> <!--[if IE 6]> <link href="assets/IE - 6 - specific.css" rel="stylesheet" type="text/css" /> <![endif]--> <link href="assets/portfolio.css" type="text/css" rel="stylesheet" media="screen" /> <script type="text/javascript" src="assets/mootools.js"></script> <script type="text/javascript" src="assets/demo.js"></script> <script type="text/javascript" src="assets/portfolio.js"></script> </head> <body> <div id="container"> <div class = "content"> <div class="span-20 last" > <div class="span-1 last"> <span class = "dheader">D</span> </div> <div class="span-19 last"> <div class="span-8 "> <span class = "hheader"> ave's Web</span> </div> <div class="span-5 last prepend-6"> <span class= "navigation"> <a href="index.php">Home</a> <a href="profile.php">Profile</a> <a href="contact.php">Contact Me</a> </span> </div> <!--end div for span-4 last prepend-6--> </div><!--end div for span-19 last--> </div> <div class = "span-1"> <div class = "eheader">e</div> <div class ="sheader">s</div> <div class ="iheader">i</div> <div class ="gheader">g</div> <div class ="nheader">n</div> <div class ="ssheader">s</div> </div> <div class = "contactPage"> <div class = "span-17 prepend-1"> <div class = "request"> Request for a price<br /> Please contact me:<span class="number"> Phone 03 359 0343</span> or <span class="number">Phone 027 308 9169</span><br /> or fill out the form blow<br /> </div> <div class="vspace"> </div> <form action=" " method= "post" enctype="multipart/form-data"><div class="boxa"><div class="label"><label for="name">Your Name</label></div><div class="formMessage"></div><div class="row"><input tabindex="1" type="text" name="name" id="name" value="" /></div><div class="label"><label for="company">Your Company</label></div><div class="formMessage"></div><div class="row"><input tabindex="2" type="text" name="company" id="company" value="" /></div><div class="label"><label for="email">Your Email</label></div><div class="formMessage"></div><div class="row"><input tabindex="3" type="text" name="email" id="email" value="" /></div><div class="label"><label for="phone">Your Phone</label></div><div class="formMessage"></div><div class="row"><input tabindex="4" type="text" name="phone" id="phone" value="" /></div><div class="label"><label for="mobilephone">Your Mobile Phone</label></div><div class="formMessage"></div><div class="row"><input tabindex="5" type="text" name="mobilephone" id="mobilephone" value="" /></div></div><div class="vspace"></div><div class="boxa"><div class="label"><label for="workRequired">Type of work required</label></div><div class="formMessage"></div><div class ='selectRow'><select id="workRequired"name="workRequired" tabindex= "6" class ="selectBox"><option value ='a new website' >a new website</option><option value ='a redesign of an existing website' >a redesign of an existing website</option><option value ='other' >other</option></select></div></div><div class="vspace"></div><div class="boxa"><div class="label"><label for="message">Additional Comments</label></div><div class="formMessage"></div><div class="textarea"><textarea tabindex="7" name="message" id="message" rows="5" cols="20" ></textarea></div><br /></div><div class="vspace"></div><div class="boxa"><div class="capthca"><img src="captcha.php" alt="captcha security code" /></div><div class="label"><label for="capthca">Security Code</label></div><div class="formMessage"></div><div class="row"><input tabindex="8" type="text" name="capthca" id="capthca" value="" /></div></div><div class="submit"><input type = "submit" id="submit" name="submit" value="Submit Request" class="submitButton" /> </div><br /></form> </div><!--end for span-17 prepend-1--> </div><!--end for contact--> <div class = "span-17 prepend-2"> <div class = "filler"> </div> <div class = "span-3"> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a> </div><!--end div for span-3--> <div class = "span-6 prepend-3"> <div class = "contact"> Dave Merrick<br /> Home Ph: 03 3590 343<br /> Mobile Ph: 027 3089 169<br /> Email: <a href="mailto:merrickdav@gmail.com">merrickdav@gmail.com</a><br /> Click here to see <a href="Images/DavesCV.odt" target="_blank">Dave's CV</a> </div> </div><!--end div for span-6 prepend-3--> <div class = "span-3"> <a href="http://jigsaw.w3.org/css-validator/check/referer"> <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" /> </a> </div><!--end div for span-3--> </div><!--span-17 prepend-2--> </div> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/159436-php-select-function/ Share on other sites More sharing options...
wildteen88 Posted May 24, 2009 Share Posted May 24, 2009 Those errors have nothing to do with PHP Its to do with your HTML that is failing to validate. Quote Link to comment https://forums.phpfreaks.com/topic/159436-php-select-function/#findComment-841113 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.