Preventing blank or already entered values
Posted on
16th Feb 2014 07:03 pm by
admin
Im trying to learn how to place a read file line by line and prevent duplicate entries and also BLANK entries, into my process php script,
using feof, I have failed many times and get so many errors such as syntax expecting . or , and so forth
this is my process.php
Did you know?Explore Trending and Topic pages for more stories like this.
<?php
$File = "links.txt";
$Handle = fopen($File, 'a');
$Data = "".$_POST['ID'];
fwrite($Handle, $Data."n");
print "Data Addedn";
fclose($Handle);
?>
<?php
countLines("links.txt");
function countLines($filepath)
{
$handle = fopen( $filepath, "r" );
$count = 0;
while( fgets($handle) )
{
$count++;
}
fclose($handle);
return $count;
}
?>
<head>
<meta http-equiv="REFRESH" content="5;test1.php"></HEAD>
please wait... navigating back!
I got fed up and deleted all my work, to start from scratch,
if feof($_POST['ID'])
{
alert 'Already entered';
return;
}
that was just one of my attempts
also im unsure if putting in /n would make it look for /n or new line, if it looks for new line and every file has the new line marker would it always return as the data was already entered?
Thanks in advance for assistance/teaching
No comments posted yet
Your Answer:
Login to answer
241
9
Other forums
PHP Search Issue
Hi, I am using the following code to search and return flights from a database. The user searches by
storing results of a function - previous result overwritten with new result
I have created a function to validate input.
function validate_dimension($value,$name) {
<
need help with mail()
hi i want to send an email with attaching pdf file using php. i have the following script but the pr
Word Trimming
Hi Guys & Gals!!
Hope you are all ok....
I need some help with the following
Help on code output
My CODE:
Code: [Select] echo "<phone>".$line["phone"].&qu
Newb advice
Hi all,
I'm a flash front end designer and I've taken on a project that needs some back end p
Multidimensional $_POST
Hello
How to get a single array from array of array (2 - dimension).
For example I have a
SHOW TABLES Help
Hi all
I have the following
Code: [Select]<?php
$sql = "SHOW TABLES&quo
How to show a complete textarea ??
I enter Client Case Notes notes in a textarea field on a PHP form. The field is 5 rows deep and 70 c
quotes changing
hi all
in my content
opening quotes " changes to “
close qu