php and javascript
<p>hello i have a problem that's maybe difficult to descripe,</p>

<p>i have an application, that simulates a pizza store. i have a page "bestellungen" ("orders")
in which i have some javascript.(the head,javascript and body i declare in page.php, from which the other ("sub")pages "extends".</p>

<p>right now, everything works, but now, i want to add to the javascript some php code. (in the "main" page.</p>

<p>in the page "bestellungen" ("orders") i read from the database</p>

<pre><code>$sql="Select * FROM pizzen_arten";
        $data=$this-&gt;_database-&gt;query($sql);    //alle daten in data gespeichert


        while($reihe = $data-&gt;fetch_array()){   

            $lfdnr=$reihe[2];                       
            $this-&gt;pizza_name[$lfdnr]   =$reihe[0];
            $this-&gt;pizza_preis[$lfdnr]  =$reihe[1];
            $this-&gt;pizza_id[$lfdnr] =$reihe[2];

        }
</code></pre>

<p>then in the same page i add all pizzas</p>

<pre><code>foreach ($this-&gt;pizza_id as $tmp)   //alle pizzen durchgehen über id, (id in tmp speichern)
{
//echo " überall wo " ist ein \ davor
    echo "&lt;img src=\"pizzen/pizza-".$this-&gt;pizza_name[$tmp].".png\" width=\"50\" height=\"50\" alt=\"Pizza ".$this-&gt;pizza_name[$tmp]."\" id=\"".$this-&gt;pizza_name[$tmp]."\" onclick=\"hinzu('".$this-&gt;pizza_name[$tmp]."')\" /&gt; ".$this-&gt;pizza_name[$tmp]." ".$this-&gt;pizza_preis[$tmp]." &amp;euro;"; 
    echo "&lt;p/&gt;";                                                                                                                                //vor variable " string beenden . für "+" dann var, dann string weiter
        //this das aktuelle obj, der schleife,  davon pizzaname (ist ein array! kein attribut), an der stelle tmp
}
</code></pre>

<p>the method "hinzu(id)" is declared in "page.php"</p>

<pre><code>function hinzu (pizza)
{

    NeuerEintrag = new Option(pizza, pizza, false, false);
    document.getElementById("warenkorbfeld").options[document.getElementById("warenkorbfeld").length] = NeuerEintrag ;

ETO;



    foreach ($this-&gt;pizza_id as $tmp)
    {

        if ($this-&gt;pizza_name[tmp]==pizza)  //array durchgehen gucken, wann der übergabe parameter ==einem pizzanamen
            echo "gesamtbetrag=gesamtbetrag"+$this-&gt;pizza_preis[$tmp];
    }

    /*if (pizza=="Margherita")
    {
        gesamtbetrag = gesamtbetrag + 4;
    }

    if (pizza=="Salami")
    {
        gesamtbetrag = gesamtbetrag + 4.50;
    }

    if (pizza=="Hawaii")
    {
        gesamtbetrag = gesamtbetrag + 5.50;
    }*/

    echo &lt;&lt;&lt; ETO

    document.getElementById('gesamtbetrag').innerHTML=gesamtbetrag ;

}
</code></pre>

<p>at first the method was without php-code, now by using php-code it doesn't work.</p>

<p>i suggest there might be a problem with "$this" or "pizza"  but i'm not quite sure wether i implemented the php code right.</p>

<p>thanks in advance</p>
