754Part IVConnectionsListing 40-12(continued) // Write out the file$doc->save($pollfile); (Best web hosting site)
754Part IVConnectionsListing 40-12(continued) // Write out the file$doc->save($pollfile); } // This stuff happens every time, whether a submission// has occurred or not. // Reading in the XML file as a DOM object// Must read fresh every timeif (!$doc->load($pollfile)) { echo Cannot read XML file. ; exit; } // Get a list of the polls in this XML document// and then pull out the start date, end date, // poll question, and possible responses. $poll_list = $doc->getElementsByTagname( Poll ); foreach ($poll_list as $poll_obj) { $id = $poll_obj->getAttribute( id ); $children = $poll_obj->childNodes; foreach ($children as $key=>$child_obj) { $node_name = $child_obj->nodeName; if ($node_name != #text && $node_name != responseSet ) { $content_str = $child_obj->nodeValue; $poll_array[ $node_name ] = $content_str; } elseif ($node_name == responseSet ) { // Get the responses$responselist = $child_obj->childNodes; foreach ($responselist as $responses) { $response_name = $responses->nodeName; if ($response_name != #text ) { $response_array[] = $responses->nodeValue; } } } } // Arrange all the data nicely$poll_startdate = $poll_array[ StartDate ]; $poll_enddate = $poll_array[ EndDate ]; $poll_name = $poll_array[ name ]; $poll_question = $poll_array[ question ]; $poll_question = stripslashes($poll_question); foreach ($response_array as $key=>$val) { $resp_str .= Option:
n ; }
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.