php - $_POST is empty while posting with file -
i using php. facing issue $_post global array. when send or add 1 record without file , enctype removed form tag working correctly. upload file , enctype set multipart/form-data $_post variable not set.i done far following code upload file.
index.php
<form action="add.php" method="post" enctype="multipart/form-data"> <input type="text" name="artist_name" /> <input type="text" name="title" /> <input type="file" name="track_file" /> </form>
add.php
<?php $artist=$_post['artist_name']; $title=$_post['title']; $song=$_files['track_file']['name']; echo $artist; echo $song; ?>
you should use isset function check if post values set. avoid notifications
Comments
Post a Comment