Third addition: 'Transfering variables'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, now I have made a simple example of what I want:

My script is devided in a PHP and a HTML Part. I have kept out several
queries, connections, table-tags etc. in the HTML part. Just imagine there
are several entries in the <select>-tag that is named "persona". What I want
is to keep all the entries in a particular box, in this case: of the
"persona"-option-box, AFTER the submit-button has been clicked and the page
has reloaded. I hope you understand now.

Regards and thanks,

André

//PHP Part
//If a person has been selected

if ($chg=='1') {

    print "Suchabfrage für ausgewählte Person";
    $abfrage4 = "select distinct Anschriften.ID as aid, Anschriften.PLZ as
aplz, Anschriften.STRASSE AS astrasse, Anschriften.HNR as ahnr from
Anschriften
    inner join Master on Anschriften.ID=Master.A inner join Master as m on
Master.FN=m.fn
    where m.NN = '$persona'";

    $ergebnis3=mysql_query($abfrage4) or die("Anfrage results1
fehlgeschlagen");



    $abfrage42 = "select distinct Firmennamen.ID as fid, Firmennamen.NAME as
    fname from Firmennamen
    inner join Master on Firmennamen.ID=Master.FN
    inner join Master as m on Master.A=m.A
    where m.NN='$persona'";

    $ergebnis32=mysql_query($abfrage42) or die("Anfrage results2
fehlgeschlagen");



    $abfrage43 = "select distinct Anschriften.ID as aid, Anschriften.PLZ as
aplz,
    Anschriften.STRASSE AS astrasse, Anschriften.HNR AS ahnr FROM
Anschriften
    INNER JOIN Master ON Anschriften.ID=Master.A
    WHERE Master.NN = '$persona'";

    $ergebnis33=mysql_query($abfrage43) or die("Anfrage results3
fehlgeschlagen");



    $abfrage44 = "select distinct Firmennamen.ID as fid, Firmennamen.NAME as
    fname from Firmennamen
    inner join Master on Firmennamen.ID=Master.FN
    where Master.NN='$persona'";

    $ergebnis34=mysql_query($abfrage44) or die("Anfrage results4
fehlgeschlagen");
}


//HTML Part

print "<form name='form1' method='post' action='$php_self'>
<select name='firmaa' size='5' class='Auswahl'
onChange=\"this.form.chgf.value='1'; document.form1.submit() \">
<option value='0'>k.A.</option> ";

while ($firm = mysql_fetch_array($ergebnis32, MYSQL_ASSOC)) {
        if ($chgf=='1') {
            $firma=$firm[fname];
        }
    unset($self);
        if ($firmaa==$firm[fid]) {
            $self='selected';
        }

    print "<option $self value='$firm[fid]'>$firm[fname]</option>";
}

while ($firm2 = mysql_fetch_array($ergebnis34, MYSQL_ASSOC)) {
        if ($chgf=='1') {
            $firma=$firm2[fname];
        }

    unset($self);
if ($firmaa==$firm2[fid]) {
 $self='selected';
}

print "<option $self value='$firm2[fid]'>$firm2[fname]</option>";

 }
 print "</select>

<select name='persona' size='5' class='Auswahl'
onChange=\"this.form.chg.value='1'; document.form1.submit()  \" >
<option value='0'>k.A.</option>";

while ($nsuche = mysql_fetch_array($ergebnis22, MYSQL_ASSOC)) {
        unset ($selp);
        if ($persona==$nsuche[pid]) {
            $selp='selected';
        }

    print "<option $selp value='$nsuche[pid]'>$nsuche[pvname] $nsuche[pname]
$nsuche[GEBURTSTAG]</option>";

}

while ($nsuche2 = mysql_fetch_array($ergebnis23, MYSQL_ASSOC)) {
        unset($selp);
        if ($persona==$nsuche2[pid]) {
             $selp='selected';
        }
    print "<option $selp value='$nsuche2[pid]'>$nsuche2[pvname]
$nsuche2[pname] $nsuche2[GEBURTSTAG]</option>";
}

print"</select>

 <input type='submit' name='akt2' value='Suchen'>
 <input type='submit' name='akt' value='Eintragen'>
 <input type='submit' name='akt4' value='Löschen'>
 <input type='submit' name='akt3' value='Zur&uuml;cksetzen'>
 <input type='hidden' name='chga' value='0'>
 <input type='hidden' name='chgf' value='0'>
 <input type='hidden' name='chg' value='0'>
 <input type='hidden' name='namep' value='$namep'>
 <input type='hidden' name='firmap' value='$firmap'>
 <input type='hidden' name='abfragetest' value='$qtest'>
 <input type='hidden' name='ergebnis23' value='$ergebnis23'>

</form>";

//******************************************





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux