i am setting up an intranet site for our company. the site has a worksheet for the employees to fill out their time and it writes to a mysql database. i set up a separate place to add more job numbers as needed. this writes to a text file. the worksheet reads from the text file into a drop down menu.
the problem... when you add a new job number, it also creates an extra line.
here is snippet from the original text file...
207.072~Loves Truck Stop Newberry
207.073~Vause Lots
207.074~Windsor House ALTA
here is what it looks like after add a new job number...
207.072~Loves Truck Stop Newberry
207.073~Vause Lots
207.074~Windsor House ALTA
~
207.075~Null
this is my code that writes to the text file....
$new_no = $_POST['new_no'];
$new_name = $_POST['new_name'];
$myFile = "./job_list.txt";
$fh = fopen($myFile,'a') or die("can't open file");
$new_list = "$new_no~$new_name\n";
fwrite($fh,$new_list);
fclose($fh);
echo $new_list;
?>
that is pretty much all that particular page does. it also has a link back to the home page, but it is just regular old html and shouldnt affect the code at all.
any thoughts on how to fix this problem? i have tried it in firefox and IE. i get the same results with both.