<?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[problema settaggio variabili]]></title><description><![CDATA[<p dir="auto">hola,</p>
<p dir="auto">dunque ho questo codice:</p>
<pre><code class="language-php"> &lt;?php
$query = mysql_query("SELECT abbonamento FROM tbl_product WHERE pd_id = {$_GET['p']}")or die(mysql_error());
   while($row = mysql_fetch_array($query))

   if($row['abbonamento']=='N') {
?&gt;
&lt;script type="text/javascript"&gt;

var shipping = new Object()
shipping["1"] = [{value:"1", text:"&lt;?php echo $lang['carta']; ?&gt;"},
                      {value:"2", text:"&lt;?php echo $lang['contrassegno']; ?&gt;"},
                      {value:"3", text:"&lt;?php echo $lang['bollettino']; ?&gt;"}];
shipping["2"] = [{value:"1", text:"&lt;?php echo $lang['carta']; ?&gt;"},
                      {value:"4", text:"&lt;?php echo $lang['bonifico']; ?&gt;"}];
shipping["3"] = [{value:"1", text:"&lt;?php echo $lang['carta']; ?&gt;"},
                      {value:"4", text:"&lt;?php echo $lang['bonifico']; ?&gt;"}];

function setCost(chooser) {
    var newElem;
    var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
    var costChooser = chooser.form.elements["id_pag"];
    while (costChooser.options.length) {
        costChooser.remove(0);
    }
    var choice = chooser.options[chooser.selectedIndex].value;
    var db = shipping[choice];
    newElem = document.createElement("option");
    newElem.text = "&lt;?php echo $lang['pag2']; ?&gt;";
    newElem.value = "";
    costChooser.add(newElem, where);
    if (choice != "") {
        for (var i = 0; i &lt; db.length; i++) {
            newElem = document.createElement("option");
            newElem.text = db[i].text;
            newElem.value = db[i].value;
            costChooser.add(newElem, where);
        }
    }
}

&lt;/script&gt;

&lt;select name="id_area" onchange="setCost(this)"&gt;
&lt;option value="" selected="selected"&gt;&lt;?php echo $lang["area"]; ?&gt;&lt;/option&gt;

&lt;option value="1"&gt;&lt;?php echo $lang["italia"]; ?&gt;&lt;/option&gt;
&lt;option value="2"&gt;&lt;?php echo $lang["Europa"]; ?&gt;&lt;/option&gt;
&lt;option value="3"&gt;&lt;?php echo $lang["extraeuropa"]; ?&gt;&lt;/option&gt;
&lt;/select&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan="8"&gt;
&lt;select name="id_pag" onchange="this.form.submit();"&gt;
&lt;option value="" selected="selected"&gt;&lt;?php echo $lang["pag"]; ?&gt;&lt;/option&gt;
&lt;/select&gt;

&lt;?php
} else { echo "fa qualcos'altro";}

    ?&gt;
</code></pre>
<p dir="auto">n pratica cosa succede: quando ricevo la var $_GET['p'] ho una condizione if, in cui if($row['abbonamento']=='N') {</p>
<p dir="auto">//mi carica la select multipla</p>
<p dir="auto">} else { echo "fa qualcos'altro";}<br />
?&gt;<br />
il problema è che quando seleziono le opzioni dalla select il form action mi fa l'update della tabella, ma perdo il valore di $_GET['p'], quindi mi genera un errore di notice e uno di sql.<br />
come posso aggirare l'ostacolo?<br />
grazie</p>
]]></description><link>https://dev.connect.gt/topic/20074/problema-settaggio-variabili</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 14:51:15 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/20074.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 30 Oct 2006 15:30:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to problema settaggio variabili on Tue, 31 Oct 2006 08:57:33 GMT]]></title><description><![CDATA[<p dir="auto">tutto è bene ciò che finisce bene. <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=bb61372b9dc" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
]]></description><link>https://dev.connect.gt/post/389260</link><guid isPermaLink="true">https://dev.connect.gt/post/389260</guid><dc:creator><![CDATA[tymba]]></dc:creator><pubDate>Tue, 31 Oct 2006 08:57:33 GMT</pubDate></item><item><title><![CDATA[Reply to problema settaggio variabili on Mon, 30 Oct 2006 17:00:28 GMT]]></title><description><![CDATA[<p dir="auto">ma che scemo....<br />
bastava aggiungere ....&amp;p={$_GET['p']}" al form action!<br />
<img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/efe798ea-6e7b-4676-a1bd-015ab3b5fc2e-sbonk.gif?v=bb61372b9dc" class="not-responsive emoji emoji-customizations emoji--sbonk" style="height:1.4em;width:auto;vertical-align:middle" title=":sbonk:" alt="" /></p>
<p dir="auto">grazie lo stesso!</p>
]]></description><link>https://dev.connect.gt/post/389281</link><guid isPermaLink="true">https://dev.connect.gt/post/389281</guid><dc:creator><![CDATA[tool]]></dc:creator><pubDate>Mon, 30 Oct 2006 17:00:28 GMT</pubDate></item><item><title><![CDATA[Reply to problema settaggio variabili on Mon, 30 Oct 2006 16:34:17 GMT]]></title><description><![CDATA[<p dir="auto">provo a spiegarmi meglio.</p>
<p dir="auto">da una pagina ricevo una var $_GET['p'].<br />
eseguo la query</p>
<pre><code class="language-php">$query = mysql_query("SELECT abbonamento FROM tbl_product WHERE pd_id = {$_GET['p']}"
</code></pre>
<p dir="auto">controllo che tipo di dato è inserito nel campo "abbonamento".<br />
se è 'N' mi carica il codice JS che ho postato e altro non è che una select multipla.<br />
Se il dato è 'S', mi carica qualcos'altro. ok?</p>
<p dir="auto">mettiamo caso che il risultato della query sia 'N'.<br />
Seleziono dalla select le opzioni che mi interessano e passo il tutto al submit.<br />
il form action fa quello che deve fare e mi ritorna la pagina aggiornata ( sono le spese di spedizone in un carrello ).<br />
e proprio lì, quando riaggiorno la pagina ( NON il refresh ) che perdo il valore di  $_GET['p'] e mi da un errore non solo di notice ma anche di SQL.</p>
<p dir="auto">quindi dovrei fare in modo che $_GET['p'] sia sempre settata....:?...forse?</p>
<p dir="auto">spero di essere stato più chiaro</p>
]]></description><link>https://dev.connect.gt/post/389275</link><guid isPermaLink="true">https://dev.connect.gt/post/389275</guid><dc:creator><![CDATA[tool]]></dc:creator><pubDate>Mon, 30 Oct 2006 16:34:17 GMT</pubDate></item><item><title><![CDATA[Reply to problema settaggio variabili on Mon, 30 Oct 2006 16:12:33 GMT]]></title><description><![CDATA[<p dir="auto">Non ho capito bene il problema. Ma se il problema è il notice è sufficiente che controlli che la variabile sia valorizzata:</p>
<pre><code>if (isset($_GET['p']))
  echo "bene";
else
  echo "Manca";
</code></pre>
]]></description><link>https://dev.connect.gt/post/389261</link><guid isPermaLink="true">https://dev.connect.gt/post/389261</guid><dc:creator><![CDATA[senamion]]></dc:creator><pubDate>Mon, 30 Oct 2006 16:12:33 GMT</pubDate></item></channel></rss>