- <?php 
- $query_anketa = $modx->db->query(" 
- 	SELECT id, pagetitle, content 
- 	FROM site_content 
- 	WHERE parent=56 
- 	AND published=1 AND deleted=0 
- "); 
- $anketa = $modx->db->makeArray($query_anketa); 
- $st_anket-  =  count($anketa)- ; 
 
- if ($st_anket) {  
- $anketa_id = $anketa[0]['id']; 
- $query_odgovori = $modx->db->query(" 
- 	SELECT tv.value 
- 	FROM site_content c 
-         LEFT JOIN site_tmplvar_contentvalues tv 
-         ON c.id=tv.contentid 
- 	WHERE c.id=$anketa_id AND tv.tmplvarid!=18 
- 	LIMIT 10 
- "); 
- $odgovori= $modx->db->makeArray($query_odgovori); 
-   
- <form action="" method="post" id="pool">		                                                  					 
- <p>'.$anketa[0]['content'].'</p> 
- <table> 
- '; 
- $i=0; foreach($odgovori as $s){ $i++; 
- 		<tr> 
-                       <td><input type="radio" name="question"  value="'.$i.'"/></td> 
-                       <td class="odg">'.$s['value'].'</td> 
-                 </tr>	 
- 	';  
- } 
-   
- for($x- = 1- ;  $x- <= count($odgovori)- ;  $x- ++ ) {
 
-   if($_POST['question']==$x) {  
-      $result[$_POST['question']] = 1 ; 
-    } 
-    else { 
-      $result[$x] = 0 ; 
-    } 
- } 
-   
- <p> 
-    <br /> 
-    <input type="submit" value="Glasuj" class="submit" />						 
- </p> 
- </form>'; 
- } 
-   
- $query_rezultati = $modx->db->query(" 
- 	SELECT tv.value 
- 	FROM site_content c 
-         LEFT JOIN site_tmplvar_contentvalues tv 
-         ON c.id=tv.contentid 
- 	WHERE c.id=$anketa_id AND tv.tmplvarid=18 
- 	LIMIT 1 
- "); 
- $rezultati= $modx->db->makeArray($query_rezultati); 
-   
- $query_rezultat = $modx->db->query(" 
-         UPDATE site_tmplvar_contentvalues SET value='$res' WHERE tmplvarid =18 AND contentid =57; 
- "); 
-   
- echo'<pre style="position:absolute;font-size:9px;background:#FFF;">'- ; 
 
- ?>