I'm trying to get the name of img file from html form, but browser shows me the following error: Notice: Undefined index: image in C:\xampp\htdocs\login tutorial\index.php on line 11
Notice: Undefined index: image in C:\xampp\htdocs\login tutorial\index.php on line 12
Here is my PHP code:
if(isset($_POST['submit'])){
$firstName = $_POST['fname'];
$lastName = $_POST['lname'];
$email = $_POST['email'];
$password = $_POST['password'];
$firstName = $_POST['fname'];
$passwordConfirm = $_POST['confPassword'];
$imageName = $_FILES['image']['name'];
$imageSize = $_FILES['image']['size'];
echo $firstName . "<br>" . $lastName . "<br>" . $email . "<br>" . $password . "<br>"
. $passwordConfirm . "<br>" . $imageName . "<br>" . $imageSize;
}
Here is my HTML:
<form method="post" action="index.php" enctype="multipart/form-data ">
<label for="fname">First Name</label><br>
<input type="text" name="fname" id="fname"><br>
<label for="lname">Last Name</label><br>
<input type="text" name="lname" id="lname"><br>
<label for="email">Email</label><br>
<input type="text" name="email" id="email"><br>
<label for="password">Password</label><br>
<input type="password" name="password" id="password"><br>
<label for="confPassword">Confirm Password</label><br>
<input type="password" name="confPassword" id="confPassword"><br>
<input type="file" name="image"><br>
<input type="submit" name="submit">
</form>
UPDATE: It looks like I did't get the image file... Any reason for that?