It should be fairly simple, but it's got me and everyone else I've asked
utterly stumped, all I need to do is place the data from a form on a
newline in a text file, I can get the data into the text file, but I
can't seem to get it on a new line.

Here's what I have at the moment:

    $quote = stripslashes($newquote);
    $quote = sprintf("$quote%s",'\n');
    $quotage = fopen("quotes.txt","a");
    fputs($quotage, $quote);
    echo"<p>New quote added to quotes.txt</p>";
    echo $quote;

The form is a standard form that posts back to it's own page, an if
statement picks up a hidden form entry and shifts the data across to the
above code, so far so good. But it's at this point that I become stuck.
What do I need to do to get it to put the new quote onto a new line of
the text file?

The reason I need it this way is that the code that pulls the quotes
back out again chooses them randomly by line. (it's a somewhat dodgy
random number generator in essence, but it does the job)

If all else fails, I could put the whole lot into a mysql database table
and redo the code for the random quote generator, but using a database
when a flat file will do seems like overkill to me.


Chris Janes

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to