So, I want to upload a file and choose (for example) "Value 1" from select tag. And then when I click Publish button I want from script to check if I selected Value 1, and if I did, then I want to put the file ("file_name") it in column "columndb", if I selected Value 2 I want to put it in some other column and so on.
<div><input type="file" name="file_name">
<div><input type="file" name="inputname">
<select id="select_id" name="select_name">
<option value="null">None</option>
<option value="value1" name="value1name">Value 1</option>
<option value="value2" name="value2name">Value 2</option>
</select></div>
<div>
<div><input type="submit" name="submit" value="Publish"></div>
</div>
<?php
if(isset($_POST['submit'])){
$filename = $_FILES['file_name']['name'];
$filename_tmp = $_FILES['file_name']['tmp_name'];
$select_tag = $_POST['select_name'];
move_uploaded_file($filename_tmp, "somewhere/$filename");
if($select_tag == 'value1name'){
$insert_db = "insert into mydb ('columndb') values ('$filename')";
$run_db = mysqli_query($db, $insert_db, MYSQLI_STORE_RESULT);
}
}
?>