If you put the values in the database then you have to worry about SQL Injection. If you aren't using parametrized quires, then you might have a serious problem with SQL Injection and moving the values to the database could be a bad idea due to this increased attack surface. In MySQL SQL injection can be used to read files like val.php, make sure your web application doesn't have "FILE" privileges. You also have to make sure your privileges are setup properly on this file. chmod 750
is a good one of this file, the last number 0 denies all access to everyone that isn't you or in your group.
by keeping the values in val.php you still have to worry about directory traversal vulnerabilities like this:
print file_get_contents("/var/www/whatever/".$_GET['FILE_NAME']);
Go though your code and pay attention to where you are reading and writing to files. Make sure you aren't passing in user control variables. If you want to get an attackers preservative on PHP and learning other ways of how files can be read i recommend reading A Study In Scarlet.