Het probleem zal in display.php op lijn 8 zitten.
Blijkbaar roep je een waarde aan die niet bestaat.
Oeps iets vergeten.....
<?php
include ('./connect.php');
if(isset($_POST['submit']))
{
$username = $_POST['username'];
$mobile = $_POST['mobile'];
$image = $_FILES['file'];
echo $username;
echo "<br>";
echo $mobile;
echo "<br>";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Display Data</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<body>
<h1>Displaying Data</h1>
</body>
</html>
Hoi,
Het bestand wat ontbrak....
[size=xsmall]
Toevoeging op 09/05/2022 18:02:14:[/size]
De laatste is dus display.php
Hoe ziet je upload-formulier eruit?
das idex.php (bij mij index.php). Dat zit er dus bij
- Ariën -
09-05-2022 18:33
gewijzigd op 09-05-2022 18:34
Ik zie daar geen upload formulier. Hoe ziethet formulier eruit als HTML-code?
<?php
require_once('./operations.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Upload</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<body>
<h1 class="text-center my- 3" >Registration Form</h1>
<div class = "container d-flex justify-content-center">
<form action="display.php" method= "POST" class="w-50" enctype="multipart/form-data">
<?php
echo inputFields("Username","username","","text");
echo inputFields("Mobile","mobile","","text");
echo inputFields("","file","","file");
?>
<button class="btn btn-dark" type="submit" name = "submit">Submit</button>
</form>
</div>
</body>
</html>
[size=xsmall]
Toevoeging op 09/05/2022 18:57:52:[/size]
Das mijn index.php. Daar wordt ook alles geupload
Maar ik zie nog geen formulier.
Daarom vraag ik ook de HTML-code. Dus tover die eens uit je browser.
die staat er toch boven? ik snap hem anders niet
Kijk, de code (nog met de fout) :
<?php
function inputFields($placeholder,$name,$value,$type)
{
$ele="
<div class=\"form-group my-4\">
<input tyoe ='$type' name='$name' placeholder='$placeholder' class=\"form-control\" value='$value' autocomplete =\"off\">
</div>
";
echo $ele;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Upload</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<body>
<h1 class="text-center my- 3" >Registration Form</h1>
<div class = "container d-flex justify-content-center">
<form action="display.php" method= "POST" class="w-50">
<div class="form-group my-4">
<input type ='text' name='username' placeholder='Username' class="form-control" value='' autocomplete ="off">
</div>
<div class="form-group my-4">
<input type ='text' name='mobile' placeholder='Mobile' class="form-control" value='' autocomplete ="off">
</div>
<div class="form-group my-4">
<input type ='file' name='file' placeholder='' class="form-control" value='' autocomplete ="off">
</div>
<button class="btn btn-dark" type="submit" name = "submit">Submit</button>
</form>
</div>
</body>
</html>