2019-04-01 17:36
浏览 57


I need to get the variable $percent_format outside of the loop for usage in my style to get the dynamical width für the div. But the Problem is i parameterized the funcion Ofen_Auslastung with a sql result from the Loop. Any idea how to fix this?

foreach ($connection->query($sql) as $row) {

                        echo "<tr>";
                            echo "<td> <a href='Kapauebersicht.php?OfenName=".$row['Name']."'><button onclick='myFunction()'><img src='http://xxx/xxx/Bilder/".$row[$j].".png' height='80px'></button></a></td>";       //Bezeichnung1
                            echo "<td>".$row[$j]."</td>";       //Bezeichnung1
                            list($total, $percent_format, $Anzahl) = Ofen_Auslastung($row[$j]);
                            echo "<td>".$row[$j]."</td>";       //Bezeichnung2
                            echo "<td>".$row[$j]."</td>";       //Bezeichnung3
                            echo "<td><div class='outter'><div class='inner' >$percent_format%</div> $Anzahl belegte Plätze sind $percent_format% Auslastung von $total Plätzen. <p /></td>";
                        echo "</tr>";

                $connection = null; //reset connection

            catch(PDOException $e)
                    echo $e->getMessage();
    echo "</table>";

            //echo "<pre>";
            //echo " ****************************************************************** <br>";

            //echo "</pre>";


<button  value="Zurück" class="Button3" onclick="location.href='ma_QualiOverview.php'">Zurück</button>
<style type="text/css">
    width: 200px;
    border:solid 1px #000;
    width:<?php echo $percent_format ?>%;
    border-right:solid 1px #000;
    background: rgb(30,87,153); /* Old browsers */
background: -moz-linear-gradient(top, rgba(30,87,153,1) 0%, rgba(41,137,216,1) 50%, rgba(32,124,202,1) 51%, rgba(125,185,232,1) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, rgba(30,87,153,1) 0%,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgba(30,87,153,1) 0%,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=0 );

thx for your help.

3条回答 默认 最新

相关推荐 更多相似问题