I am having issues submitting content from my form to my database. When using isset function, it showing that the variables are not being set.
Here is my PHP code and html code.
PHP
<?PHP
$title = $_POST['title']['name'];
if(isset($title)) {
echo 'all is well';
} else {
echo 'all is not well';
}
?>
HTML
<div class="container">
<form action="newEmptyPHP.php" method="post" enctype="multipart/form-data">
<input type="text" name="title" placeholder="title">
<input type="text" name="artist" placeholder="artist">
<input type="file" name="cover" placeholder="Upload Picture">
<input type="file" name="song" placeholder="Upload Song">
</form>
</div>
When I refresh the browser I am receiving "all is not well". What am I missing?
echo (isset($_POST['title']) ? "All is well!" : "All is not well..");-- yourtitlein the form isn't an array, so you must use$_POST['title']and nothing more to get that value.nameattribute's value is the$_POST's index.