<?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[form funziona con get e non con post]]></title><description><![CDATA[<p dir="auto">Ciao a tutti,<br />
ho bisogno di aiuto.<br />
Allora...<br />
ho fatto uno script che prende da un file txt una lista di prodotti, crea il form, il cliente compila il form segnando le quantità dei prodotti che vuole e successivamente questi vengono inviati via mail.<br />
Lo script funziona benissimo se utilizzo il method GET ma non va più se utilizzo il method POST.<br />
Siccome la lista dei prodotti è molto lunga volevo utilizzare POST altrimenti il server nn mi invia tutti i dati e poi verrebbe un link lunghissimo.<br />
Cosa può essere?<br />
Ho bisogno di una risposta urgente per piacere ne ho bisogno il prima possibile.<br />
Grazie.</p>
]]></description><link>https://dev.connect.gt/topic/35197/form-funziona-con-get-e-non-con-post</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 21:29:48 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/35197.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 12 May 2007 10:59:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to form funziona con get e non con post on Sat, 12 May 2007 12:57:36 GMT]]></title><description><![CDATA[<p dir="auto">Siccome ho girato e sto girando tuttora su google in cerca di un'illuminazione ma non sono riuscito a trovare assolutamente niente che mi risolva il problema  metto anche direttamente lo script da me fatto che magari può essere d'aiuto.</p>
<p dir="auto">Oltre ai campi coi prodotti presi file txt ho aggiunto 3 campi vuoti per ogni sezione e 5 alla fine di questi in modo da poter permettere l'aggiunta di altri prodotti non presenti in lista.</p>
<p dir="auto">form.php</p>
<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;title&gt;Documento senza titolo&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;?php
$id=0;
$z=0;


echo "&lt;form method=\"POST\" action=\"send.php\"&gt;\n"; /*inizializza il form*/
if (!$fp= fopen("list-food-drink.txt","r")) {
echo "Spiacente, ci sono problemi con il caricamento del file.";
} else {
while($linea!="-------")
{
$linea = fgets($fp, 255);
echo "&lt;fieldset&gt;&lt;legend&gt;$linea&lt;/legend&gt;";     /*Apre il fieldset*/
    while($linea!="\r\n"&amp;&amp;$linea!="-------")
    {
    $linea = fgets ($fp, 255);
    if ($linea!="\r\n"&amp;&amp;$linea!="-------") {
    $linea = str_replace(array("\r\n", "\r", "\n"), "", $linea);
    echo "&lt;label for=\"$linea\"&gt;${linea}&lt;/label&gt;&lt;input name=\"$linea\" type=\"text\" id=\"$linea\" size=\"4\" maxlength=\"3\" value=\"0\" onFocus=\"if (this.value=='0') {this.value=''}\" onBlur=\"if ((this.value=='') || (this.value==NULL)) {this.value='0'}\"&gt;\n&lt;input name=\"$id\" type=\"text\" id=\"$id\" size=\"7\" maxlength=\"10\" value=\"\"&gt;&lt;br&gt;\n";$id++;}
    else     {
            for ($x=0;$x&lt;3;$x++) {
                                $emptyrow_name="n".$z;
                                $emptyrow_quantity="q".$z;
                                $emptyrow_unit="u".$z;
                                echo "&lt;input name=\"$emptyrow_name\" type=\"text\" id=\"$emptyrow_name\" size=\"25\" maxlength=\"25\" value=\"Additional product\" onFocus=\"if (this.value=='Additional product') {this.value=''}\" onBlur=\"if ((this.value=='') || (this.value==NULL)) {this.value='Additional product'}\"&gt;&lt;input name=\"$emptyrow_quantity\" type=\"text\" id=\"$emptyrow_quantity\" size=\"7\" maxlength=\"10\" value=\"Quantity\" onFocus=\"if (this.value=='Quantity') {this.value=''}\" onBlur=\"if ((this.value=='') || (this.value==NULL)) {this.value='Quantity'}\"&gt;&lt;input name=\"$emptyrow_unit\" type=\"text\" id=\"$emptyrow_unit\" size=\"7\" maxlength=\"10\" value=\"Unit\" onFocus=\"if (this.value=='Unit') {this.value=''}\" onBlur=\"if ((this.value=='') || (this.value==NULL)) {this.value='Unit'}\"&gt;&lt;br&gt;\n";
            $z++;}
            echo "&lt;/fieldset&gt;";
            }
    }
}
fclose($fp);
}
echo "&lt;fieldset&gt;&lt;legend&gt;Additional products&lt;/legend&gt;";
for ($x=0;$x&lt;5;$x++)    {$emptyrow_name="n".$z;
                         $emptyrow_quantity="q".$z;
                         $emptyrow_unit="u".$z;
                         echo "&lt;input name=\"$emptyrow_name\" type=\"text\" id=\"$emptyrow_name\" size=\"25\" maxlength=\"25\" value=\"Additional product\"onFocus=\"if (this.value=='Additional product') {this.value=''}\" onBlur=\"if ((this.value=='') || (this.value==NULL)) {this.value='Additional product'}\"&gt;&lt;input name=\"$emptyrow_quantity\" type=\"text\" id=\"$emptyrow_quantity\" size=\"7\" maxlength=\"10\" value=\"Quantity\"onFocus=\"if (this.value=='Quantity') {this.value=''}\" onBlur=\"if ((this.value=='') || (this.value==NULL)) {this.value='Quantity'}\"&gt;&lt;input name=\"$emptyrow_unit\" type=\"text\" id=\"$emptyrow_unit\" size=\"7\" maxlength=\"10\" value=\"Unit\"onFocus=\"if (this.value=='Unit') {this.value=''}\" onBlur=\"if ((this.value=='') || (this.value==NULL)) {this.value='Unit'}\"&gt;&lt;br&gt;\n";
                    $z++;}
?&gt;
&lt;/fieldset&gt;
&lt;fieldset&gt;&lt;legend&gt;Invia richiesta&lt;/legend&gt;&lt;input name="submit" type="submit" value="Invia" /&gt;&lt;/fieldset&gt;


&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p dir="auto">send.php</p>
<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;title&gt;Documento senza titolo&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;?php
$i=0;
$z=0;
$id=0;
$vector = array();
if (!$fp= fopen("list-food-drink.txt","r")) {
echo "Spiacente, ci sono problemi con il caricamento del file.";
} else {
while($linea!="-------")
{
$linea = fgets ($fp, 255);
    while($linea!="\r\n"&amp;&amp;$linea!="-------")
    {
    $linea=fgets ($fp, 255);
    if ($linea!="\r\n"&amp;&amp;$linea!="-------") {
    $linea = str_replace(array("\r\n", "\r", "\n"), "", $linea);
    $quant=$_POST['$linea'];
    $altq=$_POST['$id'];$id++;
    if ($quant &gt; 0) {$vector[$i]=array("name"=&gt;"$linea","q"=&gt;"$quant","id"=&gt;"$altq");$i++;}
    }
    
    }
    for ($x=0;$x&lt;3;$x++)
        {
        $emptyrow_name=$_POST["n".$z];
        $emptyrow_quantity=$_POST["q".$z];
        $emptyrow_unit=$_POST["u".$z];
        $z++;
        if ($emptyrow_name!="Additional product") 
            {
            $vector[$i]=array("name"=&gt;"$emptyrow_name","q"=&gt;"$emptyrow_quantity","id"=&gt;"$emptyrow_unit");
            $i++;
            }
        }
}
fclose ($fp);
}
for ($x=0;$x&lt;5;$x++)
    {
    $emptyrow_name=$_POST["n".$z];
    $emptyrow_quantity=$_POST["q".$z];
    $emptyrow_unit=$_POST["u".$z];
    $z++;
    if ($emptyrow_name!="Additional product") 
        {
        $vector[$i]=array("name"=&gt;"$emptyrow_name","q"=&gt;"$emptyrow_quantity","id"=&gt;"$emptyrow_unit");
        $i++;
        }
    }
for ($ii=0; $ii&lt;$i; $ii++)
{
    $a=$ii+1;
    $message.=$a."\t".$vector[$ii]["name"]."\t".$vector[$ii]["q"]."\t".$vector[$ii]["id"]."\r\n";
}


print_r($vector);
?&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p dir="auto">struttura file txt:</p>
<p dir="auto">categoria1<br />
prodotto1<br />
prodotto2</p>
<h2>categoria2<br />
prod1<br />
prod2</h2>
]]></description><link>https://dev.connect.gt/post/508482</link><guid isPermaLink="true">https://dev.connect.gt/post/508482</guid><dc:creator><![CDATA[paci]]></dc:creator><pubDate>Sat, 12 May 2007 12:57:36 GMT</pubDate></item></channel></rss>