Ritorno ID pagina
-
...di nuovo qui....se non ci foste voi!!!
Dunque il problema sembrava semplice invece non mi ritorna l'ID della pagina ma solo dell'elemento che vado a cancellare, posto il codice
<? include("../config.php"); $obj=new sast1com(); $temput=$_SESSION['temput']; $temppass=$_SESSION['temppass']; $id=$_GET['id']; ?> <? if($temput==$obj->user && $temppass==$obj->password){ ?> <title>Modifica Fattura</title> <?php include('header_js.php'); ?> </head><body> <? $obj->connessione(); $result = mysql_query("select * from fatture where id='$id'"); while($array=mysql_fetch_array($result)){ $progressivo=$array[progressivo]; $idpagamento=$array[idpagamento]; $dataemissione=$array[dataemissione]; $pagato=$array[pagato]; $datapagamento=$array[datapagamento]; $scadenza=$array[scadenza]; $testo =$array[testo]; $anno =$array[anno]; $idpagamento =$array[idpagamento]; $idcliente =$array[idcliente]; $notepagina =$array[notepagina]; $imponibile=$array[imponibile]; $tiva=$array[tiva]; $fattura=$array[fattura]; $note_desc=$array[note_desc]; $note_int=$array[note_int]; $rif_ddt=$array[rif_ddt]; $rif_ordine=$array[rif_ordine]; $rif_pagamento=$array[rif_pagamento]; $rif_luogodestinazione=$array[rif_luogodestinazione]; } ?> <? $obj->connessione(); $result = mysql_query("select * from pagamenti where id='$id'"); while($array=mysql_fetch_array($result)){ $scadenza=$array[scadenza]; } ?> <form id="formID" action="mod_fattura.php" method="post"> <h2> <span class="d">Modifica Fattura</span> <span class="tab11">N°: <input name="progressivo" type="text" value="<? echo $progressivo;?>" size="7"> </span><span class="tab12"> Anno: <input name="anno" type="text" value="<? echo $anno;?>" size="4"> </span> </h2> <div style="width: 770px; "> <table width="100%" cellspacing="7"> <tr> <td width="21%" class="tab13" >Data emissione<span class="tab17">*</span></td> <td width="41%"><input type="text" name="data" id="datepicker" class="validate[required] text-input datepicker" value="<? echo $dataemissione;?>"></td> <td width="38%" rowspan="2"><textarea name="rif_denominazione" rows=3 disabled="disabled" readonly="readonly" id="rif_denominazione" ><? echo cliente($idcliente);?></textarea></td> </tr> <tr> <td class="tab13" >Cliente<span class="tab17">*</span></td> <td><select name="destinatario" size="0" id="destinazione" class="validate[required]"> <option value="<? echo $denominazione?>"> Seleziona un cliente...</option> <? $obj=new sast1com(); $obj->connessione(); $result = mysql_query("select * from clienti order by denominazione"); while($array=mysql_fetch_array($result)){ if($array[id]!=$idcliente)echo "<option value=\"$array[id]\">".$array[denominazione]."</option>"; else echo "<option value=\"$array[id]\" selected>".$array[denominazione]."</option>"; } ?> </select> </tr> </table> <table width="100%" cellspacing="7"> <tr> <td width="15%" class="tab13" >Rif. Ordine</td> <td width="85%" align="right" > <span id="countBox0" style="text-align:right;color:#C30">80</span> <input name="rif_ordine" type="text" class="tab15B" id="rif_ordine" value="<? echo $rif_ordine;?>" /></td> </tr> </table> </div> <div style="width: 770px; "> <table width="100%" cellspacing="7"> <tr> <td width="20%" class="tab13" >Scadenza<span class="tab17">*</span></td> <td width="30%"><input type="text" name="scadenza" id="datepicker3" class="validate[required] text-input datepicker" value="<? echo $scadenza;?>"></td> <td width="20%" class="tab13" >Rif. DDT</td> <td width="30%"></td> </tr> </table> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td><br> <textarea rows=3 name="rif_pagamento" id="rif_pagamento" class="validate[required]"><? echo $scadenza?></textarea></td> <td> Max: <span id="countBox1" style="text-align:right;color:#C30">6 </span>DDT<br> <textarea name="rif_ddt" class="tab15" id="rif_ddt"><? echo $rif_ddt?></textarea></td> </tr> </table> </div> <div style="width: 770px; "> <table width="320px" border="0" cellspacing="7"> <tr> <td class="tab13"> Note per la "Descrizione" di inizio fattura</td> </tr> </table> <textarea name="note_desc" id="area1" rows="3" class="tab15"><? echo $note_desc;?></textarea> </div> <div style="width: 770px; "> <table width="100%" class="tableborder1" id="miatabella"> <tr> <td class="sectionHeading1">Descrizione</td> <td width="20" align="center" class="sectionHeading1">Quantita</td> <td width="70" align="center" class="sectionHeading1">Prezzo</td> <td width="70" align="center" class="sectionHeading1">Importo</td> <td width="70" align="center" class="sectionHeading1">Iva</td> <td width="50" align="center" class="sectionHeading1">Modifica</td> <td width="50" align="center" class="sectionHeading1">Cancella</td> </tr> <? $obj->connessione(); $result = mysql_query("select * from fattureitem where idfattura='$id'"); while($array=mysql_fetch_array($result)){ echo" <tr> <td class=\"textDisplay1\">$array[note]</td> <td align=\"center\" class=\"textDisplay1\"><font size=4>$array[quantita]</font></td> <td align=\"center\" class=\"textDisplay1\"><font size=4>$array[prezzo]</font></td> <td align=\"center\" class=\"textDisplay1\"><font size=4>$array[importo]</font></td> <td align=\"center\" class=\"textDisplay1\"><font size=4>$array[iva]</font></td> <td align=\"center\" class=\"textDisplay1\"><a href=\"modvocefatt.php?id=$array[id]&id3=$id\"><img src=\"images/mod.png\" border=0></a></td> <td align=\"center\" class=\"textDisplay1\"><a href=\"mod_fattura.php?id=$array[id]&op=del\" onclick=\"return(confirm('Sei sicuro di voler cancellare??'))\"><img src=\"images/cancella.png\" border=0></a></td> </tr>"; } ?> </table> </div> <div align="right" style="width: 770px; "> <input type="hidden" value="<?echo $id;?>" name="id2"> <input type="hidden" value="<?echo $id;?>" name="id3"> <input type="hidden" value="mod" name="op"> <table border="0" cellspacing="7"> <tr> <td width="120" align="right"> </td> <td width="300" align="right"> </td> <td width="200" class="tab13">Totale imponibile</td> <td align="right"><input type="text" name="imponibile" id="imponibile" size="20" value="<? echo $totale_importo;?>"></td> </tr> <tr> <td class="tab13" align="left">Pagato?</td> <td align="left"><input type="checkbox" name="pagato" value="1" <?if($pagato==1)echo "checked";?>></td> <td class="tab13">Totale Iva </td> <td align="right" ><input type="text" name="tiva" id="tiva" size="20" value="<? echo $totale_iva;?>"></td> </tr> <tr> <td class="tab13" align="left">Data</td> <td align="left"><input type="text" name="datapagamento" id="datepicker2" value="<?echo $datapagamento;?>"></td> <td class="tab13">>Totale fattura</td> <td align="right"><input type="text" name="fattura" id="fattura" size="20" value="<? echo $totale_fattura;?>"></td> </tr> </table> </div> <div align="right" style="width: 770px; "> <table width="100%" cellspacing="7"> <tr> <td width="25%" class="tab13" >Data di Consegna<span class="tab17">*</span></td> <td width="25%" class="tab13" >Luogo di destinazione<span class="tab17">*</span></td> <td width="50%"></td> </tr> </table> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="25%" align="center"><input type="text" name="rif_dataconsegna" value="<? echo date('d/m/Y');?>"></td> <td><textarea rows=3 name="rif_luogodestinazione" id="rif_luogodestinazione"><? echo $rif_luogodestinazione;?></textarea></td> </tr> </table> </div> <div style="width: 770px; "> <table width="320px" border="0" cellspacing="7"> <tr> <td class="tab13"> Note per uso interno</td> </tr> </table> <textarea name="note_int" rows="3" class="tab15"><? echo $note_int;?></textarea> </div> <center> <input class="submit" type="submit" value="Modifica"/> </center> </form> </div> </body> </html><? }else{ echo"<script language=\"javascript\">"; echo"document.location.href='errore.php'"; echo"</script>"; }?> <? if($_POST['op']=="mod"){ $destinatario = $_POST['destinatario']; $pagamento = $_POST['pagamento']; $data = $_POST['data']; $datapagamento = $_POST['datapagamento']; $progressivo= $_POST['progressivo']; $anno= $_POST['anno']; $pagato=$_POST['pagato']; //$idpagamento=$_POST['idpagamento']; $testo =$_POST['testo']; $scadenza =$_POST['scadenza']; $note_int =$_POST['note_int']; $note_desc =$_POST['note_desc']; $rif_ddt =$_POST['rif_ddt']; $rif_ordine =$_POST['rif_ordine']; $rif_pagamento =$_POST['rif_pagamento']; $rif_dataconsegna =$_POST['rif_dataconsegna']; $rif_luogodestinazione =$_POST['rif_luogodestinazione']; $imponibile = $_POST['imponibile']; $tiva = $_POST['tiva']; $fattura= $_POST['fattura']; $id2 =$_POST['id2']; $obj=new sast1com(); $obj->connessione(); $dati=mysql_query("update fatture set imponibile='$imponibile',tiva='$tiva',fattura='$fattura',dataemissione='$data',anno='$anno',idcliente='$destinatario',idpagamento='$pagamento',progressivo='$progressivo',pagato='$pagato',datapagamento='$datapagamento',testo='$testo',scadenza='$scadenza',note_desc='$note_desc',note_int='$note_int',rif_ddt='$rif_ddt',rif_ordine='$rif_ordine',rif_pagamento='$rif_pagamento',rif_dataconsegna='$rif_dataconsegna',rif_luogodestinazione='$rif_luogodestinazione' where id='$id2'"); if($dati) echo "mod correttamente"; else echo "non è stato mod per motivi tecnici: ".mysql_error(); echo"<script language=javascript>"; echo"document.location.href='sel_fatture.php?id=$id2'"; echo"</script>"; } ?> <? if ($_GET['op']=="del"){ $obj=new sast1com(); $obj->connessione(); $dati=mysql_query("delete from fattureitem where id='$id'"); if($dati) echo "cancellato correttamente"; else echo "non stato cancellato per motivi tecnici: ".mysql_error(); echo"<script language=javascript>"; echo"document.location.href='mod_fattura_vuoto.php?id=$id'"; echo"</script>"; } ?> <? function cliente($id){ $obj=new sast1com(); $obj->connessione(); $dati=mysql_query("select * from clienti where id=$id"); while($array=mysql_fetch_array($dati)){ return "".$array[denominazione]."\n".$array[cap]." ".$array[citta]." - ".$array[provincia]." - ".$array[nazione]."\n".$array[indirizzo].""; } } ?>quindi quando vado ad usare questa
<a href=\"modvocefatt.php?id=$array[id]&id3=$id\"><img src=\"images/mod.png\" border=0></a>è tutto ok...mentre se cancello con questa
<a href=\"mod_fattura.php?id=$array[id]&op=del\" onclick=\"return(confirm('Sei sicuro di voler cancellare??'))\"><img src=\"images/cancella.png\" border=0></a>nella parte finale dello script
echo"document.location.href='mod_fattura_.php?id=$id'";mi ritopra l'ID dellemento selezionato e e non della pagina dove ero... quindi vado fuori pagina!!!!!!
Grazie anticipatamente a tutti...speriamo possiate aiutarmi!!!
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi