Location: PHPKode > projects > LAMP School > tutori/modi.php
<?php
    @include("../php-ini.php");
    @include("../funzioni.php");
	
	// istruzioni per tornare alla pagina di login 
	session_start();	
    $tipoutente=$_SESSION["tipoutente"]; //prende la variabile presente nella sessione
	if ($tipoutente=="")
	   {
	   header("location: ../login/login.php"); 
	   die;
	   }
	
    //Imposta i colori dei link
    print"<body bgcolor='white' link='$color_link' vlink='$color_alink' alink='$color_vlink'>";	
    //imposta la tabella del titolo
	print("<table border=0 width='100%'>
		<tr>
		   <td align ='center' bgcolor='$bgcolor_titolo'><strong><font size='+1'>MODIFICA DATI</font></strong></td>
		</tr>
		</table> <br><br>"); 
	$Connessione=mysql_connect($db_server,$db_user,$db_password);
	if (!$Connessione)
	{
		print("<H1>Connessione al server mySQL fallita</H1>");
		exit;	
	};
	$DB=mysql_select_DB($db_nome);
	if (!$DB)
	{
		print("<H1>Connessione al database stage fallita</H1>");
		exit;	
	};
	$i=$_GET[id];
	$Query="SELECT * FROM tutori WHERE idtutore='$i'";
	$Ris=mysql_query($Query);
    if ($Data=mysql_fetch_object($Ris));
    { print "<form action='pro2.php' method='get'><center>";
	 print ("<table>");
	   if ($err!=1)
	   {
	   $id=$Data->idtutore;
	   $nome=$Data->nome;
	   $idcomn=$Data->idcomnasc;
	   $cognome=$Data->cognome;
	   $data=$Data->datanascita;
	   $indirizzo=$Data->indirizzo;
	   $idcomr=$Data->idcomres;
	   $tel=$Data->telefono;
	   $email=$Data->email;
	   $tip=$Data->tipo;
	   $cel=$Data->telcel;
	   }
	   $query1="SELECT * FROM comuni WHERE idcomune=$Data->idcomnasc";
	  $Result1=mysql_query($query1);
	  $Data1=mysql_fetch_object($Result1);
	  
	  $query2="SELECT * FROM comuni"; //WHERE idcomune=$Data->idcomres";
	  $Result2=mysql_query($query2);
	  $Data2=mysql_fetch_object($Result2);
	  $query3="SELECT * FROM comuni ";
	  $Result3=mysql_query($query3);
	  $Data3=mysql_fetch_object($Result3);
      print ("<tr> <td>  <input type='hidden' name='id' value='$id'> </td> </tr>");
	  print ("<tr> <td><i> Cognome</i> </td> ");
	  print ("<td> <input type='text' value='$cognome' name='cognome' size='30' maxlength='30'> </td> </tr>");
	  print ("<tr> <td> <i>Nome </i></td>");
	  print(" <td> <input type='text' value='$nome' name='nome' size='30' maxlength='30'> </td> </tr>");
	  print ("<tr> <td> <i>Data di nascita </i> </td> ");
	  print ("<td> <input type='text' value='$data' name='data' size='10'  maxlength='10'> ");
	  print ("<tr> <td><i> Indirizzo </i> </td> ");
	  print ("<td> <input type='text' value='$indirizzo' name='indirizzo' size='30' maxlength='30'> </td> </tr>");
	  print ("<tr> <td><i> Comune di nascita</i> </td> ");
	  print "<td> <select name='idcomn' size=1>)";
	  
	  while ($Data3=mysql_fetch_object($Result3))
	  {
	    if ($Data3->idcomune==$idcomn)
		{
		   print "<option  value='$Data3->idcomune' selected> $Data3->denominazione";	
		 }
		 else
		 {
		   print "<option  value='$Data3->idcomune' > $Data3->denominazione";	
		 }
		}	
		
		 
		print ("<tr> <td><i> Comune di residenza</i> </td> ");
	  print "<td> <select name='idcomr' size=1>)";
		while ($Data2=mysql_fetch_object($Result2))
	  {
	    if ($Data2->idcomune==$idcomr)
		{
		   print "<option  value='$Data2->idcomune' selected> $Data2->denominazione";	
		 }
		 else
		 {
		   print "<option  value='$Data2->idcomune' > $Data2->denominazione";	
		 }
		}						                
	       print ("<tr> <td><i> telefono </i></td> ");
	       print ("<td> <input type='text' value='$tel' name='tel' size='15' > ");
	       print ("<tr> <td><i> Email </i> </td> ");
	       print ("<td> <input type='text' value='$email' name='email' size='30' maxlength='30'> </td> </tr>");
	       print ("<tr> <td><i> Telefono Cellulare </i> </td> ");
	       print ("<td> <input type='text' value='$cel' name='cel' size='30' maxlength='30'> </td> </tr>");
	       print ("<tr> <td><i> Tipo </i> </td> ");
	       $query4="SELECT * FROM tutori";
	  $Result4=mysql_query($query4);
	    print "<td> <select name='tip' size=1>)";
	switch ($tip)
	{
	case 'p':{ print ("<option value='p' selected>");
		break;}
	case 'm':{ print ("<option value='m' selected>");
		break;}
	case 't':{ print ("<option value='t' selected>");
		break;}
		}
		   print "<option  value='p' >p ";
		    print "<option  value='m'>m";
			 print ("<option  value='t'>t");
			 print ("</select>");
		   	
		   print("<input type='hidden' value='$id' name='id'>");
           print ("<tr> <td><center> <input type='submit' value='MODIFICA'>	</td> </tr>"); 
	print "</form>";
	
	}
	print "<tr><td></table>";
	print "<form action='../tutori/mostra1.php' method ='GET'> 
		
		  <input type='submit' value='<< Indietro'>
		  </form>";
		  
	print "<form action='../tutori/pro2.php' method ='GET'> 
		
		
		  </form>";
		 
		 
	mysql_close($Connessione);
?>
Return current item: LAMP School