<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Notice: Undefined variable]]></title><description><![CDATA[<p dir="auto">Salve a tutti...ho appena iniziato a studiare il PHP usando il libro PHP della HOEPLI...purtroppo mi son reso conto che gli esempio che vi sono riportati non sono sempre corretti(mancano segni di punteggiature e caonfusione varia...)...oggi stavo provando a fare questo esercizio,ma mi da vari problemi</p>
<pre><code class="language-html">&lt;?php
     echo "&lt;FORM NAME=modulo METHOD=post ACTION=".PHP_SELF."&gt;";
?&gt;

primo numero&lt;INPUT TYPE NAME="n1" TYPE="text"&gt;
secondo numero&lt;INPUT TYPE="text" NAME="n2"&gt;
terzo numero&lt;INPUT TYPE="text" NAME="n3"&gt;
&lt;INPUT TYPE="submit" NAME="Submit" VALUE="Calcola maggiore e minore"&gt;
&lt;/FORM&gt;
&lt;?php
     if (($n1&gt;$n2)&amp;&amp;($n1&gt;$n3))
        $mag=$n1;
     else
     {
      if  (($n2&gt;$n3)&amp;&amp;($n2&gt;$n1))
          $mag=$n2;
      else
          $mag=$n3;
     }
     echo "Maggiore: ".$mag;
?&gt;
</code></pre>
<p dir="auto">Il primo problema che si presente è che dice<br />
<strong>Notice</strong>:  Use of undefined constant PHP_SELF - assumed 'PHP_SELF' in <strong>c:\progetti php\eser1_.php</strong> on line <strong>2</strong><br />
,ma cercando su google ho letto che basta cambiare PHP_SELF in $<em>SERVER['PHP_SELF'] (magari se qualcuno vuole spiegarmi anche il perchè di questo fatto...) ,ma non son riuscito a togliere gli errori<br />
<strong>Notice</strong>:  Undefined variable:  n1 in **c:\progetti php\eser1</em>.php** on line <strong>11</strong></p>
<p dir="auto"><strong>Notice</strong>:  Undefined variable:  n2 in <strong>c:\progetti php\eser1_.php</strong> on line <strong>11</strong></p>
<p dir="auto"><strong>Notice</strong>:  Undefined variable:  n2 in <strong>c:\progetti php\eser1_.php</strong> on line <strong>15</strong></p>
<p dir="auto"><strong>Notice</strong>:  Undefined variable:  n3 in <strong>c:\progetti php\eser1_.php</strong> on line <strong>15</strong></p>
<p dir="auto"><strong>Notice</strong>:  Undefined variable:  n3 in <strong>c:\progetti php\eser1_.php</strong> on line <strong>18</strong></p>
<p dir="auto">e alla fine la pagina non fa neanche quello per cui è progettata,ovvero restituire il maggiore...mi sapreste aiutare?Vi ringrazio</p>
]]></description><link>https://dev.connect.gt/topic/18750/notice-undefined-variable</link><generator>RSS for Node</generator><lastBuildDate>Mon, 30 Nov 2026 00:30:21 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/18750.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 12 Oct 2006 12:06:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Notice: Undefined variable on Thu, 12 Oct 2006 13:56:24 GMT]]></title><description><![CDATA[<p dir="auto">Vabbe', questo succede al primo giro perchè non sono inizializzate, l'esempio è veramente assurdo. Comunque sostituisci le 3 righe così:</p>
<pre><code>[COLOR=#000080]$n1 = isset($_POST['n1']) ? $_POST['n1'] : 0;[/COLOR]
[COLOR=#000080]$n2 = isset($_POST['n2']) ? $_POST['n2'] : 0;[/COLOR]
[COLOR=#000080]$n3 = isset($_POST['n3']) ? $_POST['n3'] : 0;[/COLOR]
[COLOR=#000080]
</code></pre>
<p dir="auto">In realtà andrebbe fatto bene che se non ci sono variabili in post allora lancia il form, altrimenti fa vedere i valori...</p>
]]></description><link>https://dev.connect.gt/post/380454</link><guid isPermaLink="true">https://dev.connect.gt/post/380454</guid><dc:creator><![CDATA[senamion]]></dc:creator><pubDate>Thu, 12 Oct 2006 13:56:24 GMT</pubDate></item><item><title><![CDATA[Reply to Notice: Undefined variable on Thu, 12 Oct 2006 12:49:43 GMT]]></title><description><![CDATA[<p dir="auto">Fatto...ora son scomparsi quegli errori e son comparsi questi...<br />
<strong>Notice</strong>:  Undefined index:  n1 in <strong>c:\progetti php\eser1.php</strong> on line <strong>11</strong></p>
<p dir="auto"><strong>Notice</strong>:  Undefined index:  n2 in <strong>c:\progetti php\eser1.php</strong> on line <strong>12</strong></p>
<p dir="auto"><strong>Notice</strong>:  Undefined index:  n3 in <strong>c:\progetti php\eser1.php</strong> on line <strong>13</strong></p>
]]></description><link>https://dev.connect.gt/post/380472</link><guid isPermaLink="true">https://dev.connect.gt/post/380472</guid><dc:creator><![CDATA[demon3]]></dc:creator><pubDate>Thu, 12 Oct 2006 12:49:43 GMT</pubDate></item><item><title><![CDATA[Reply to Notice: Undefined variable on Thu, 12 Oct 2006 12:32:02 GMT]]></title><description><![CDATA[<p dir="auto">Usa una tecnologia poco sicura che è normalmente disabilitata. Le variabili proveniente dal form devono essere dichiarate esplicitamente.<br />
Fai così, queste righe:</p>
<pre><code>[COLOR=#000080]&lt;?php
     if (($n1&gt;[/COLOR]$n2)&amp;&amp;($n1&gt;$n3))
</code></pre>
<p dir="auto">trasformale così:</p>
<pre><code>[COLOR=#000080]&lt;?php
$n1 = $_POST['n1'];[/COLOR]
[COLOR=#000080]$n2 = $_POST['n2'];[/COLOR]
[COLOR=#000080]$n3 = $_POST['n3'];[/COLOR]
[COLOR=#000080] 
[/COLOR][COLOR=#000080]     if (($n1&gt;[/COLOR]$n2)&amp;&amp;($n1&gt;$n3))
</code></pre>
]]></description><link>https://dev.connect.gt/post/380453</link><guid isPermaLink="true">https://dev.connect.gt/post/380453</guid><dc:creator><![CDATA[senamion]]></dc:creator><pubDate>Thu, 12 Oct 2006 12:32:02 GMT</pubDate></item></channel></rss>