Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Community > Tech > [risultato script in iframe]come?
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
maynard80
.novellino.

User info:
Registered: Jul 2007
Posts: 3 (0.00 al dì)
Location: Milano (e non interland, tendo a precisare)
Corso: informatica
Anno: SESTO
Time Online: 12 Days, 14:28:38 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
[risultato script in iframe]come?

ciao ragazzi, sto imparando piano piano a usare php e mySQL, ho capito come si fa una form che manda le variabili tramite metodo post e come si fanno ad utilizzare tali variabili attraverso la variabile $_POST nella pagina definita nell'action della form.

vorrei però visualizzare i dati della mia query all'interno di una iframe senza cambiare pagina, è possibile?

diciamo che ho una tabella giocatori con 3 campi (cognome,ruolo,quotazione)e voglio poter scegliere un giocatore in base al ruolo e alla sua quotazione e visualizzare il risultato nella iframe sottostante.


Se poi fosse possibile vorrei poter selezionare 1 o + giocatori visualizzati e utilizzarli per una seconda query al database.

__________________
msn Messenger: giamma80 at tiscali.it
ATHENA !

10-05-2005 11:03
Click Here to See the Profile for maynard80 Click here to Send maynard80 a Private Message Find more posts by maynard80 Add maynard80 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Napolux
-29 Kg da Settembre 2005

User info:
Registered: Jun 2002
Posts: 3666 (0.42 al dì)
Location: Giussano (MI)
Corso: F28
Anno: ???
Time Online: 21 Days, 19:29:36 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Re: [risultato script in iframe]come?

Originally posted by maynard80
vorrei però visualizzare i dati della mia query all'interno di una iframe senza cambiare pagina, è possibile?


Mmmh certo che e' possibile....

Allora fai cosi':

Nella form metti nel parametro action="" la stessa pagina in cui c'e' il form...

Poi nel punto della pagina dove vuoi l'iframe crea una DIV che usi questa classe CSS (trucco fighissimo per non usare gli iframe (difficili e non sempre compatibili) veri preso qui: http://www.constile.org/tips/emulare_gli_iframe/ )

.iframe {
width: 250px; // o le misure che vanno bene per te
height: 250px;
overflow: auto;
padding: 5px;
}

all'interno della div metti qualcosa del tipo:

PHP:

if isset($_POST["una var del form"])
{
// FAI QUERY

// STAMPA RISULTATO QUERY
}



Cosi' l'iframe fasullo verra' riempito solo se ci sono dati inviati dal form
Se invece vuoi che il finto iframe compaia solo se e' stato inviato il modulo allora metti il tag <div class="iframe"> subito all'inizio dell'IF e il tag </div> alla fine dell'if prima della graffa.

Per la seconda domanda che fai dovresti creare sempre all'interno della div un form con un flag per ogni calciatore che stampi...

Se hai dubbi chiedi pure.

__________________
Napolux.com

10-05-2005 11:57
Click Here to See the Profile for Napolux Click Here to See the Blog of Napolux Click here to Send Napolux a Private Message Visit Napolux's homepage! Find more posts by Napolux Add Napolux to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
maynard80
.novellino.

User info:
Registered: Jul 2007
Posts: 3 (0.00 al dì)
Location: Milano (e non interland, tendo a precisare)
Corso: informatica
Anno: SESTO
Time Online: 12 Days, 14:28:38 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

dunque, ho fatto come dici, ma sono molto imbranato

PHP:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="images/emx_nav_left.css" type="text/css">
</head>

<body>
    <form action="iframe.php" method="post" enctype="multipart/form-data"> 
        <table>
        <tr><td>cognome: </td><td><input type="text" name="cognome"></td></tr> 
        <tr><td>ruolo: </td><td><input type="text" name="ruolo"></td></tr>
        <tr><td>valore: </td><td><input type="text" name="valore"></td></tr> 
        <tr><td></td><td><input type="submit" value="seleziona"></td></tr>
        </table>
    </form> 
    <?php 
        $db_host 
"localhost"
        
$db_user "root"
        
$db_password ""
        
$db_name "fantaprova"

        
$DBconn mysql_connect($db_host$db_user$db_password
            or die(
"Connessione non riuscita: " mysql_error()); 
        
mysql_select_db($db_name$DBconn
            or die (
"Errore nella selezione del database. Verificare i parametri impostati.");     
                 

        
$cognome=$_POST['cognome'];
        
$ruolo=$_POST['ruolo'];
        
$valore=$_POST['valore'];
        echo 
"hai selezionato $ruolo con prezzi a partire da $valore";
        
$query "SELECT * FROM giocatori where ruolo='".$ruolo."'and cognome like'%".$cognome."%' and valore>$valore";
        
$res mysql_query($query);
        if (
$res){
            echo 
"<br><br>GIOCATORI<br><br>Trovati ".mysql_num_rows($res)." record";
        }
    
       if (!
$res) {
         echo 
"Errore nella query richiesta.\n";
         exit;
       } 
    
    
     
?>  
    <div class="iframe">
    <table><tr><td width="160"><b>Cognome</b></td><td width="160"><b>Ruolo</b></td><td><b>Valore</b></td></tr>
    <?
            while ($row = mysql_fetch_array($res)) {
                printf ("<tr>");
                printf ("<td>%s</td><td>%s</td><td>%s</td>", $row[0], $row[1], $row[2]);
                printf ("<tr>");
            }  
        ?></table></div>
</body>
</html>




ma come si fa a far si che l'iframe abbia la scroll bar laterale? così fa schifo poichè quando visione molte tuple si allunga!

__________________
msn Messenger: giamma80 at tiscali.it
ATHENA !

Last edited by maynard80 on 10-05-2005 at 14:48

10-05-2005 13:47
Click Here to See the Profile for maynard80 Click here to Send maynard80 a Private Message Find more posts by maynard80 Add maynard80 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Napolux
-29 Kg da Settembre 2005

User info:
Registered: Jun 2002
Posts: 3666 (0.42 al dì)
Location: Giussano (MI)
Corso: F28
Anno: ???
Time Online: 21 Days, 19:29:36 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

La classe CSS dovrebbe fare lo scrolling automaticamente, leggi il link al sito che ti ho dato...

A me non a mai dato problemi con codice PHP da stampare mette la barra quando diventa troppo lungo sia su IE che su Firefox....

Mah...

__________________
Napolux.com

11-05-2005 08:00
Click Here to See the Profile for Napolux Click Here to See the Blog of Napolux Click here to Send Napolux a Private Message Visit Napolux's homepage! Find more posts by Napolux Add Napolux to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
maynard80
.novellino.

User info:
Registered: Jul 2007
Posts: 3 (0.00 al dì)
Location: Milano (e non interland, tendo a precisare)
Corso: informatica
Anno: SESTO
Time Online: 12 Days, 14:28:38 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

allora ho sbagliato io qualcosa, perchè a me non mette nessuna barra...

tra l'altro la stringa

PHP:

if isset($_POST('nomevariabile'))

mi da errore

__________________
msn Messenger: giamma80 at tiscali.it
ATHENA !

Last edited by maynard80 on 11-05-2005 at 13:06

11-05-2005 11:37
Click Here to See the Profile for maynard80 Click here to Send maynard80 a Private Message Find more posts by maynard80 Add maynard80 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
maynard80
.novellino.

User info:
Registered: Jul 2007
Posts: 3 (0.00 al dì)
Location: Milano (e non interland, tendo a precisare)
Corso: informatica
Anno: SESTO
Time Online: 12 Days, 14:28:38 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

la classe è uguale alla tua:

code:
.iframe { color:#000066; background-color:#999999; width: 500px; // o le misure che vanno bene per te height: 500px; overflow:auto; padding: 5px; border-style:solid; border:1px; border-color:#666666; }

__________________
msn Messenger: giamma80 at tiscali.it
ATHENA !

11-05-2005 13:14
Click Here to See the Profile for maynard80 Click here to Send maynard80 a Private Message Find more posts by maynard80 Add maynard80 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Napolux
-29 Kg da Settembre 2005

User info:
Registered: Jun 2002
Posts: 3666 (0.42 al dì)
Location: Giussano (MI)
Corso: F28
Anno: ???
Time Online: 21 Days, 19:29:36 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Boh...

Il manuale parla chiaro...

Che errore ti da'?

__________________
Napolux.com

11-05-2005 13:23
Click Here to See the Profile for Napolux Click Here to See the Blog of Napolux Click here to Send Napolux a Private Message Visit Napolux's homepage! Find more posts by Napolux Add Napolux to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
maynard80
.novellino.

User info:
Registered: Jul 2007
Posts: 3 (0.00 al dì)
Location: Milano (e non interland, tendo a precisare)
Corso: informatica
Anno: SESTO
Time Online: 12 Days, 14:28:38 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

non da nessu errore, semplicemente non parte lo scroll e l'"iframe" si allunga a dismisura tanto quante sono le righe da rappresentare.

__________________
msn Messenger: giamma80 at tiscali.it
ATHENA !

11-05-2005 13:56
Click Here to See the Profile for maynard80 Click here to Send maynard80 a Private Message Find more posts by maynard80 Add maynard80 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
DeepBlue
tired guy

User info:
Registered: Sep 2003
Posts: 4258 (0.52 al dì)
Location: CSN
Corso: Info tlc
Anno:
Time Online: 52 Days, 8:40:31 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by maynard80
if isset($_POST('nomevariabile'))
mi da errore

Sbagli la sintassi: usa $_POST['nome_variabile'] (se hai php > 4.1.0)

__________________
~ get Debian! ~ get FreeBSD! ~ get OpenBSD! ~

Last edited by DeepBlue on 11-05-2005 at 14:16

11-05-2005 14:13
Click Here to See the Profile for DeepBlue Click Here to See the Blog of DeepBlue Click here to Send DeepBlue a Private Message Find more posts by DeepBlue Add DeepBlue to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
DeepBlue
tired guy

User info:
Registered: Sep 2003
Posts: 4258 (0.52 al dì)
Location: CSN
Corso: Info tlc
Anno:
Time Online: 52 Days, 8:40:31 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by maynard80

.iframe {
border-style:solid;
border:1px;
border-color:#666666;
}


brrr....

usa una regola sola per definire tutta quella roba:

border: 1px solid #666666;

__________________
~ get Debian! ~ get FreeBSD! ~ get OpenBSD! ~

11-05-2005 14:15
Click Here to See the Profile for DeepBlue Click Here to See the Blog of DeepBlue Click here to Send DeepBlue a Private Message Find more posts by DeepBlue Add DeepBlue to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ripe
- up in the mountains -

User info:
Registered: Jun 2002
Posts: 9469 (1.10 al dì)
Location: Cinisellooo
Corso: TICO TICO
Anno: Primo
Time Online: 61 Days, 2:33:39 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Off-Topic:
Che sintassi da nerd, quella del Php... :D

__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»

11-05-2005 14:28
Click Here to See the Profile for ripe Click Here to See the Blog of ripe Click here to Send ripe a Private Message Find more posts by ripe Add ripe to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
maynard80
.novellino.

User info:
Registered: Jul 2007
Posts: 3 (0.00 al dì)
Location: Milano (e non interland, tendo a precisare)
Corso: informatica
Anno: SESTO
Time Online: 12 Days, 14:28:38 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

grazie, cmq non risolve il mio problema.. va beh per ora rinuncio

__________________
msn Messenger: giamma80 at tiscali.it
ATHENA !

11-05-2005 19:22
Click Here to See the Profile for maynard80 Click here to Send maynard80 a Private Message Find more posts by maynard80 Add maynard80 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 07:48.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.328 seconds (64.22% PHP - 35.78% MySQL) con 25 query.