Ho un problema ho realizzato un form che manda tramite post dei campi ad un database e anche un immagine a una directory però mi dice che ci sono variabili indefinite:
Notice: Undefined index: image in C:\Users\Renato\Desktop\Social\htdocs\network\ax.p hp on line 41
Notice: Undefined index: image in C:\Users\Renato\Desktop\Social\htdocs\network\ax.p hp on line 42
Notice: Undefined index: image in C:\Users\Renato\Desktop\Social\htdocs\network\ax.p hp on line 43
Notice: Undefined index: image in C:\Users\Renato\Desktop\Social\htdocs\network\ax.p hp on line 45
Notice: Undefined index: extension in C:\Users\Renato\Desktop\Social\htdocs\network\ax.p hp on line 47
Cioè quando vado ad estrapolare i dati dall'array $_file[...]ECC mi dice che il parametro image è indefinito e pure è lo stesso che invio dal form date un occhiata.
INIZIO CODICE PHP ax.phpcodice:<html> <head> <link href="stile.css" rel="stylesheet" type="text/css"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"></script> </head> <body> <center> <div id="registrazione"> <form action="ax.php" enctype="multipart/data-data" method="POST" > Nome:<input type="text" name="nome" id="nome"> Cognome:<input type="text" name="cognome" id="cognome"> Email:<input type="text" name="email" id="email"> Password:<input type="password" name="password" id="password"> <input name="image" type="file"/> <input name="up" type="submit" id="submit" value="ok"> </form> </div> <center> </body> </html>
codice:<?php include("uno.php"); ?> <html> <body> <?php $email=$_POST['email']; //trovo caratteri dannos $password=$_POST['password']; //sha1 cripta cifra la password $nome=$_POST['nome']; $cognome=$_POST['cognome']; if($email==""){ echo "Campo email vuoto"; header("refresh:1; URL= http://localhost/network/registrazione.php"); } elseif($password==""){ echo "Campo password vuoto"; header("refresh:1; URL= http://localhost/network/registrazione.php"); } elseif($nome==""){ echo "Campo nome vuoto"; header("refresh:1; URL= http://localhost/network/registrazione.php"); } elseif($cognome==""){ echo "Campo cognome vuoto"; header("refresh:1; URL= http://localhost/network/registrazione.php"); } else{ $sql="INSERT INTO accesso (email,password,nome,cognome) VALUES ('$email','$password','$nome','$cognome')"; $lancio=mysql_query($sql); if(!$lancio){ die("erroreeeeee" . mysql_error()); } $id=mysql_insert_id(); echo $id; //--------immagine----------------- $size=$_FILES["image"]["size"]; $type=$_FILES["image"]["type"]; $nomeimmagine=$_FILES["image"]["name"]; $tipo=pathinfo($nomeimmagine); $percorsoo=$_FILES["image"]["tmp_name"]; $percorso="immagini/"; if(move_uploaded_file($percorsoo, $percorso . $id.".".$tipo['extension'])){ session_start(); $_SESSION["id"]=$id; $_SESSION["email"]=$email; $_SESSION["cognome"]=$cognome; $_SESSION["user"]= $nome; //emailllllllllll $destinatario=$email; $oggetto="Proviamo"; $messaggio="Benvenuto in MySocial make your social"; $mittente='From:"MySocial admin"<gennarocola@gmail.com>\r\n'; mail($destinatario,$oggetto,$messaggio,$mittente); //------------------- header("location: http://localhost/network/inde.php"); } } ?> </body> </html>

Rispondi quotando
era proprio quello l'errore grazie dell'aiuto
