ciao a tutti!
ho questo codice per inserire una persona all'interno della tabella team sul mio db:
<?php
include('function/config.inc');
session_start();
$flag = $_POST['flag'];
$nome = $_POST['nome'];
$cognome = $_POST['cognome'];
$user =$_POST['user'];
$password = $_POST['password'];
$mail = $_POST['mail'];
$ruolo = $_POST['ruolo'];
if ($flag == 99) {
$query="INSERT INTO utenti (nome,cognome,user,password,mail,ruolo) VALUES ('$nome','$cognome','$user','$password','$mail','$ ruolo')";
// echo "QUERY INSERIMENTO: ".$query;
mysql_query($query,$connessione) or die('Could not connect:' .mysql_error());
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Inserisci nel team!</title>
</head>
<body>
<center>
<h1>Inserisci nel team!</h1>
<?php
$user = $_SESSION['utente'];
$sql = "SELECT grado FROM utenti WHERE user='$user'";
$result=mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$_SESSION['grado'] = $row['grado'];
}
?>
<form action="inserisci_team.php" method="post" style="border: medium solid red;"class="modulo">
<input type="hidden" name="flag" value="99">
<table border="0" cellspacing="5" cellpadding="6" width="350">
<tr>
<td width="150">Nome:</td>
<td width="200"><input type="text" name="nome"></td>
</tr>
<tr>
<td width="150">Cognome:</td>
<td width="200"><input type="text" name="cognome"></td>
</tr>
<tr>
<td width="150">User:</td>
<td width="200"><input type="text" name="user" value=""></td>
</tr>
<tr>
<td width="150">Password:</td>
<td width="200"><input type="text" name="password" value=""></td>
</tr>
<tr>
<td width="150">E-mail:</td>
<td width="200"><input type="text" name="mail"></td>
</tr>
<tr>
<td width="150">Ruolo:</td>
<td width="200"><input type="text" name="ruolo"></td>
</tr>
<tr>
<td width="150"><input type="reset" value="Svuota Modulo"></td>
<td width="200"><input type="submit" name="submit" value="Inserisci"></td>
</tr>
</table>
</form>
</center>
</body>
<?php
mysql_close($connessione);
?>
</html>
però oltre a nome, cognome ecc vorrei anche inserire una foto della persona. come faccio?Codice PHP:
<?php include('function/config.inc'); session_start(); $flag = $_POST['flag']; $nome = $_POST['nome']; $cognome = $_POST['cognome']; $user =$_POST['user']; $password = $_POST['password']; $mail = $_POST['mail']; $ruolo = $_POST['ruolo']; if ($flag == 99) { $query="INSERT INTO utenti (nome,cognome,user,password,mail,ruolo) VALUES ('$nome','$cognome','$user','$password','$mail','$ruolo')"; // echo "QUERY INSERIMENTO: ".$query; mysql_query($query,$connessione) or die('Could not connect:' .mysql_error()); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Inserisci nel team!</title> </head> <body> <center> <h1>Inserisci nel team!</h1> <?php $user = $_SESSION['utente']; $sql = "SELECT grado FROM utenti WHERE user='$user'"; $result=mysql_query($sql); while ($row = mysql_fetch_array($result)) { $_SESSION['grado'] = $row['grado']; } ?> <form action="inserisci_team.php" method="post" style="border: medium solid red;"class="modulo"> <input type="hidden" name="flag" value="99"> <table border="0" cellspacing="5" cellpadding="6" width="350"> <tr> <td width="150">Nome:</td> <td width="200"><input type="text" name="nome"></td> </tr> <tr> <td width="150">Cognome:</td> <td width="200"><input type="text" name="cognome"></td> </tr> <tr> <td width="150">User:</td> <td width="200"><input type="text" name="user" value=""></td> </tr> <tr> <td width="150">Password:</td> <td width="200"><input type="text" name="password" value=""></td> </tr> <tr> <td width="150">E-mail:</td> <td width="200"><input type="text" name="mail"></td> </tr> <tr> <td width="150">Ruolo:</td> <td width="200"><input type="text" name="ruolo"></td> </tr> <tr> <td width="150"><input type="reset" value="Svuota Modulo"></td> <td width="200"><input type="submit" name="submit" value="Inserisci"></td> </tr> </table> </form> </center> </body> <?php mysql_close($connessione); ?> </html>