View Single Post
Old 01-18-2008, 01:59 AM   #2 (permalink)
buildakicker
The Acquainted
 
buildakicker's Avatar
 
Join Date: Jan 2008
Posts: 118
Thanks: 21
buildakicker is on a distinguished road
Default

Welp, Icanhavethattookaboutasecond. I am still not exactally sure how to get stuff from between the lines...

PHP Code:
if(isset($_POST['newpost'])){
    
//get the info from the form, post to text file.
    
$title stripslashes($_POST['title']);
    
$category stripslashes($_POST['category']);
    
$body stripslashes($_POST['body']);
    
    
//add data XML style
    
$data "<post>" "\n" "<category>"$category "</category>" "\n" "<title>" $title "</title>" "\n" "<date>" $todaysdate "</date>" "\n" "<body>" "\n"$body "</body>" "\n" "</post>""\n\r";
    
    
//add data to CSV Text File
    //$data = $category . "||" . $title . "||" . $body . "\n";
    //open file and store contents
    
$file fopen('posts.xml','a+');
    if (!
$file) {echo 'ERROR: Unable to open file.'; exit;} 
    
//post current post to $data, get $dataxml from file, then write $alldata back to file
    
while (!feof($file)) {
        
$dataxml fgets($file);
    }
    
$alldata $dataxml.$data;
    
// Write the data to the file
    
fwrite($file$alldata);
    
// Close the file
    
fclose($file);
    
    
$postupdated "You have created a new post!";

__________________
SkiLeases.com
buildakicker is offline  
Reply With Quote