- Home
- Categorie
- Coding e Sistemistica
- Coding
- modifica elementi database
- 
							
							
							
							
							sarebbe preferibile che tu inserissi il codice qui sul forum.... perciò editerò il tuo precedente post... Ciao 
 
- 
							
							
							
							
							
questo il sorgente....(scusa massimux) [php]<body> 
 <center>
 <table cellpadding="0" cellspacing="0" width="752" height="643" id="table2">
 <!-- MSTableType="layout" -->
 <tr>
 <td valign="top" colspan="2" height="119">
 <img border="0" src="../images/titoli/testa_squadra.jpg" width="752" height="119"></td>
 </tr>
 <tr>
 <td valign="top" width="103">
 <?php echo menu(); ?></td>
 <td valign="top" width="649" height="524">
 <h1 align="center">Modifica Atleta </h1>
 <?php
 if(isset($_POST['nome'])):
 $id=$_POST['id'];
 $data= mktime("0", "0", "0", $_POST['mese'], $_POST['giorno'], $_POST['anno']);
 $file = $_FILES['uploadfile'];
 $nome=$_POST['nome'];
 $cognome=$_POST['cognome'];
 $sesso=$_POST['sesso'];
 $categoria=$_POST['categoria'];
 $soprannome=$_POST['soprannome'];
 $luogo=$_POST['luogo'];
 $gara=$_POST['gara'];
 $altezza=$_POST['altezza'];
 $peso=$_POST['peso'];
 $allenatore=$_POST['allenatore'];
 $cantante=$_POST['cantante'];
 $adulto=$_POST['adulto'];
 $sogno=$_POST['sogno'];
 $nuotatore=$_POST['nuotatore'];
 $studi=$_POST['studi'];
 $nuoto=$_POST['nuoto'];
 $notnuoto=$_POST['notnuoto'];
 $sopporto=$POST['sopporto'];
 if($file['error'] == UPLOAD_ERR_OK and is_uploaded_file($file['tmp_name'])) {
 $imm="../images/atleti/" . $nome . "" . $cognome . ".jpg";
 $size= getimagesize($file['tmp_name']);
 list($width, $height, $type, $attr) = $size;
 if($width>120 && $height>160)
 exit('<p>Errore durante l'iserimento della foto. Dimensioni non corrette!</p>');
 else{
 $sql="UPDATE atleti SET
 nome='$nome',
 cognome='$cognome',
 data='$data',
 sesso='$sesso',
 categoria='$categoria',
 soprannome='$soprannome',
 luogo='$luogo',
 gara='$gara',
 altezza='$altezza',
 peso='$peso',
 allenatore='$allenatore',
 cantante='$cantante',
 adulto='$adulto',
 sogno='$sogno',
 nuotatore='$nuotatore',
 studi='$studi',
 nuoto='$nuoto',
 notnuoto='$notnuoto',
 sopporto='$sopporto',
 img='$imm'
 WHERE id_atl='$id'";
 //move_uploaded_file($file['tmp_name'],$imm);
 copy($file['tmp_name'],$imm);
 }
 if (mysql_query($sql))
 echo '<p>Atleta modificato correttamente</p>';
 else{
 exit('<p>Errore durante la modifica dell'atleta: ' .
 mysql_error() . '</p>');
 }
 $nid=mysql_insert_id();
 }
 ?>
 <p style="padding-left:20; margin-top:0; margin-bottom:0"><a href="index.php">Torna alla home</a></p>
 <?php
 else:
 $id=$_GET['id'];
 $atl=@mysql_query("SELECT * FROM atleti WHERE id_atl='$id'");
 if(!$atl){
 exit('Non è possibile trovare l'atleta.' -
 mysql_error() . '</p>');
 }
 $atl=mysql_fetch_array($atl);
 $nome=$atl['nome'];
 $cognome=$atl['cognome'];
 $soprannome=$atl['soprannome'];
 $luogo=$atl['luogo'];
 $gara=$atl['gara'];
 $altezza=$atl['altezza'];
 $peso=$atl['peso'];
 $allenatore=$atl['allenatore'];
 $cantante=$atl['cantante'];
 $adulto=$atl['adulto'];
 $sogno=$atl['sogno'];
 $nuotatore=$atl['nuotatore'];
 $studi=$atl['studi'];
 $nuoto=$atl['nuoto'];
 $notnuoto=$atl['notnuoto'];
 $sopporto=$atl['sopporto'];
 $data=$atl['data'];
 $sesso=$atl['sesso'];
 $img=$atl['img'];
 $data_it=date("d-m-Y",$data);
 ?>
 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
 <p style="margin-top:0; margin-bottom:0">Nome:<input type="text" name="nome" width="250" value="<?php echo $nome; ?>"></p>
 <p style="margin-top:5; margin-bottom:0">Cognome:<input type="text" name="cognome" width="250" value="<?php echo $cognome; ?>"></p>
 <p style="margin-top:5; margin-bottom:0">Soprannome:<input type="text" name="soprannome" width="250" value="<?php echo $soprannome; ?>"></p>
 <p style="margin-top:5; margin-bottom:0">Luogo di Nascita:<input type="text" name="luogo" width="250" value="<?php echo $luogo; ?>"></p>
 <p style="margin-top:5; margin-bottom:0">Data di Nascita: <select name="giorno" value="<?php echo $giorno; ?>">
 <?php
 for($c=1; $c<=31; $c++)
 echo "<option value=$c>$c";
 ?>
 </select>
 <select name="mese" value="<?php echo $mese; ?>">
 <option value=1>Gennaio</option>
 <option value=2>Febbraio</option>
 <option value=3>Marzo</option>
 <option value=4>Aprile</option>
 <option value=5>Maggio</option>
 <option value=6>Giugno</option>
 <option value=7>Luglio</option>
 <option value=8>Agosto</option>
 <option value=9>Settembre</option>
 <option value=10>Ottobre</option>
 <option value=11>Novembre</option>
 <option value=12>Dicembre</option></select>
 <select name="anno" value="<?php echo $anno; ?>">
 <?php
 for($i=1979; $i<=2007; $i++)
 echo "<option value=$i>$i";
 ?>
 </select></p>
 <p style="margin-top:5; margin-bottom:0">Sesso: <select name="sesso" value="<?php echo $sesso; ?>">
 <option value=1>M</option>
 <option value=2>F</option></select>
 <p style="margin-top:5; margin-bottom:0">Gara Preferita:<input type="text" name="gara" width="250" value="<?php echo $gara; ?>"></p>
 <p style="margin-top:5; margin-bottom:0">Altezza:<input type="text" name="altezza" width="35" value="<?php echo $altezza; ?>"> cm</p>
 <p style="margin-top:5; margin-bottom:0">Peso:<input type="text" name="peso" width="35" value="<?php echo $peso; ?>"> Kg</p>
 <p style="margin-top:5; margin-bottom:0">Allenatore:<input type="text" name="allenatore" width="250" value="<?php echo $allenatore; ?>"></p>
 <p style="margin-top:5; margin-bottom:0">Cantante Preferito:<input type="text" name="cantante" width="250" value="<?php echo $cantante; ?>"></p>
 <p style="margin-top:5; margin-bottom:0">Cosa farai da adulto?<input type="text" name="adulto" width="250" value="<?php echo $adulto; ?>"></p>
 <p style="margin-top:5; margin-bottom:0">Il mio sogno è:<input type="text" name="sogno" width="250" value="<?php echo $sogno; ?>"></p>
 <p style="margin-top:5; margin-bottom:0">Nuotatore Preferito:<input type="text" name="nuotatore" width="250" value="<?php echo $nuotatore; ?>"></p>
 <p style="margin-top:5; margin-bottom:0">Studi:<input type="text" name="studi" width="250" value="<?php echo $studi; ?>"></p>
 <p style="margin-top:5; margin-bottom:0">Per me il nuoto è:<input type="text" name="nuoto" width="250" value="<?php echo $nuoto; ?>"></p>
 <p style="margin-top:5; margin-bottom:0">Quando non nuoto...<input type="text" name="notnuoto" width="250" value="<?php echo $notnuoto; ?>"></p>
 <p style="margin-top:5; margin-bottom:0">Non sopporto...<input type="text" name="sopporto" width="250" value="<?php echo $sopporto; ?>"></p>
 Categoria: <select name="categoria" value="<?php echo $categoria; ?>">
 <option value=1>Seniores</option>
 <option value=2>Cadetti</option>
 <option value=3>Juniores</option>
 <option value=4>Ragazzi</option>
 <option value=5>Esordienti A</option>
 <option value=6>Esordienti B</option>
 <option value=7>Esordienti C</option></select>
 <p style="margin-top:5; margin-bottom:0">Foto:<input type="file" name="uploadfile" value="<?php echo $img; ?>"> (Dimensione Max: 120x160)</p>
 <input type="text" name="id" value="<?php echo $id; ?>" disabled />
 <p style="margin-top:5; margin-bottom:0"><input type="submit" value="Modifica" /></p>
 </form>
 <?php endif; ?>
 <p style="margin-top: 0; margin-bottom: 0" align="center">
 <a href="javascript:history.go(-1);"><img border="0" src="../images/Varie/back.gif" width="80" height="48"></a></td>
 </tr>
 </table></center>
 </body>
 </html>
 [/php]
 
- 
							
							
							
							
							
**$id=$_POST['id']; 
 **mica lo prendi dal get?prova a mettere 
 $id = $_GET['id'];
 
- 
							
							
							
							
							
Notice: Undefined index: id in C:\Programmi\EasyPHP 2.0b1\www\Catania Nuoto 2000 PHP\admin\modifica_atleta.php on line 38 la linea 38 è qst: 
 [PHP]$id=$_GET['id'];
 [/PHP]Ciau e grazie x la pazienza... 
 
- 
							
							
							
							
							
linea 16 $id=$_POST['id']; non capisco come da te possa essere la 38... 
 
- 
							
							
							
							
							
xkè in quel codice manca tutta l'head.... 
 
- 
							
							
							
							
							
In quella riga non c'è nessun errore secondo me sentiamo cosa dicono gli altri 
 
- 
							
							
							
							
							
provo a farlo non in locale... benissimo sul dominio vero non da nessun errore, ma non modifica un bel tubos........ 
 
- 
							
							
							
							
							
pero' scusate, la prima parte del codice non deve andare prima del doctype declaration? 
 o almeno io l'ho sempre messa li'...
 magari fai una prova perche' non so se e' una regola o non cambia nulla.
 
- 
							
							
							
							
							
 
- 
							
							
							
							
							
erica... non c'entra nulla  
 
- 
							
							
							
							
							
@Skyline said: erica... non c'entra nulla  
 ok scusate pensavo potesse servire a qualcosa.... comunque vuol solo dire di metterlo all'inizio del file sopra tutto, come riga 1 per capirci... ciao!  
 
- 
							
							
							
							
							
quindi nessuna soluzione?? 
 
- 
							
							
							
							
							
nada?? 
 vi prego aiutatemi......
 Ciao
 
- 
							
							
							
							
							
up:D