This is my first time tackling php coding.
I'm trying to make an app that will allow a user to sort data uploaded from a file, and spit it out into 2 new files.
It can't be automated, because the human user needs to make the decision on where the data goes. Here's what I have so far
Code:
<body>
<?php
$file = '/public_html/temp/names.txt' or die('Could not read file!');
$data = file($file) or die('Could not read file!');
?>
<?php
echo $data[0];
?>
<Form name ="form1" Method ="Post" ACTION ="nametool.php">
<Input type = 'Radio' Name ='choice' value= 'first'>first
<Input type = 'Radio' Name ='choice' value= 'last'>last
<Input type = 'Radio' Name ='choice' value= 'trash'>trash
<P>
<Input type = "Submit" Name = "Submit1" Value = "Select">
</P>
</FORM>
</body>
So I've got the radio buttons finished..and figured out how to parse the content from the file into an array.
What I'm confused about now is do I need the "isset" statement and how will the if/else tie in with that?
After a choice is made and the first item in the array is written to the sorted file it should delete that content and move to the next item in the array.
I read their was a way to do this (deleting one element in an array) last night but I'm unable to find it again. Something like a "push" statement?
Also I'm guessing my if/else statements will have to be nested?
If I can get this figured out it will save me a huge amount of time sorting data by cut and paste in a txt file.  Thanks for any and all help.
|