Telefonino.net network
 
| HOMEPAGE | INDICE FORUM | REGOLAMENTO | ::. NEI PREFERITI .:: | RSS Forum | RSS News | NEWS web | NEWS software |
| PUBBLICITA' | | ARTICOLI | WIN XP | VISTA | WIN 7 | REGISTRI | SOFTWARE | MANUALI | RECENSIONI | LINUX | HUMOR | HARDWARE | DOWNLOAD | | CERCA nel FORUM » |

Torna indietro   WinTricks Forum > Software > Programmazione

Notices

Rispondi
 
Strumenti discussione
Vecchio 02-02-2007, 17.22.55   #1
bietolino
Junior Member
 
Registrato: 18-12-2005
Messaggi: 57
bietolino promette bene
[php] problema per traferire dati tra due pagine

Ciao a tutti ho un grosso problema e mi serve un grosso aiuto urgente per favore aiutatemi.
Ho realizzato una pagina php per inserire dei dati in un db mysql. dato che la query di insert è molto grande perchè ci sono molti campi ho realizzato la pagina con dreamweaver e eseguito la query tramite la procedura semplificata (non so se ce l'avete presente).
ora ho un problema devo passare un dato che l'utente ha inserito in un campo del forum ad un'altra pagina ma non so come fare.
praticamente non posso passare questo valore tramite post perchè il form è stato impostato dal programma per fare il redirect sulla pagina in quanto la query è scritta nella stessa pagina dove è presente il modulo che l'utente deve compilare. come posso far passare quel valore? vi mando il codice della pagina solo la parte più importante perchè è lunghissimo

Codice:
<?php require_once('Connections/sementiero.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO questionario (nome, localita, sede, costitutore, moltiplicatore, tipologia, res, viv, mi, me, cf, fa1, fb1, fc1, fa2, fb2, fc2, fa3, fb3, fc3, fa4, fb4, fc4, fa5, fb5, fc5, fa6, fb6, fc6, fa7, fb7, fc7, fa8, fb8, fc8, fa9, fb9, fc9, dm1, dp1, dm2, dp2, dm3, dp3, dm4, dp4, dp5, pf, us, uf, cm, hm, ap1, a1, ap2, a2, ap3, a3, ap4, a4, a5, r1, ra1, r2, ra2, r3, ra3, r4, ra4, r5, ra5, r6, ra6, r7, ra7, r8, ra8, r9, ra9) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($HTTP_POST_VARS['nome'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['localita'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['sede'], "text"),
                       GetSQLValueString(isset($HTTP_POST_VARS['costitutore']) ? "true" : "", "defined","1","0"),

                      continua taglio per semplificare .....

  mysql_select_db($database_sementiero, $sementiero);
  $Result1 = mysql_query($insertSQL, $sementiero) or die(mysql_error());
  $insertGoTo = "q2.php";
  if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?>
<html>
<body>
<form action="" method="POST" name="form1" target="_self">
continua...
bietolino non è collegato   Rispondi citando
Vecchio 05-02-2007, 17.01.11   #2
P8257 WebMaster
Gold Member
 
Registrato: 07-01-2002
Loc.: Milano
Messaggi: 2.863
P8257 WebMaster promette bene
Vediamo se ho capito bene ...
tu hai una pagina che registra dati su un db. e questa pagina oltre ad inserire svariati dati, deve prenderne anche uno che arriva da un'altra pagina tramite la compilazione di un form a cui tu però non hai accesso a livello codice giusto ?
P8257 WebMaster non è collegato   Rispondi citando
Rispondi


Utenti attualmente attivi che stanno leggendo questa discussione: 1 (0 utenti e 1 ospiti)
 
Strumenti discussione

Regole di scrittura
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is ON
Gli smilies sono ON
[IMG] è ON
Il codice HTML è OFF

Vai al forum

Discussioni simili
Discussione Autore discussione Forum Risposte Ultimo messaggio
[Notebook] Problema alimentazione e perdita dati? Fabbio Hardware e Overclock 3 02-05-2006 17.13.58
Problema con Excel e aggiornamento dati ascenzo Office suite 1 27-01-2005 14.10.12
Strano problema con connessione a libero Mond Internet e Reti locali 0 12-01-2005 22.26.08
problema spyware: mi si aprono 2 pagine di ie dopo inserimento url nella barra indiri linfen Windows 7/Vista/XP/ 2003 1 17-12-2004 16.13.25
Problema accesso su pagine web massi77 Software applicativo 2 04-01-2002 23.13.40

Orario GMT +2. Ora sono le: 08.30.01.


E' vietata la riproduzione, anche solo in parte, di contenuti e grafica.
Copyright © 1999-2017 Edizioni Master S.p.A. p.iva: 02105820787 • Tutti i diritti sono riservati
L'editore NON si assume nessuna responsabilità dei contenuti pubblicati sul forum in quanto redatti direttamente dagli utenti.
Questi ultimi sono responsabili dei contenuti da loro riportati nelle discussioni del forum
Powered by vBulletin - 2010 Copyright © Jelsoft Enterprises Limited.