@gaston9x19Apr 18.2005 — #That's doable too, PHP can create and write to files. Have a look at this thread, I posted an example showing how to get form data to write to a file:
P.S. Oh, yeah, the same code that writes to "blank.php" will also create "blank.php" if it doesn't already exist. This example page was supposed to read from the file first though, so you have to create the file to read from.
@hamstarauthorApr 20.2005 — #When you say the file contains arrays what do you mean? [/quote] As in all the code for the arrays and the arrays data is contained in the file.
Are you hoping to modify this file or just use its contents?[/quote] Both, I have to get the files contents, and append to them.
$commentsarray[0]="Yeah man, you don't let those bastards push us around this site is great!"; $commentsarray[1]="Great site man"; $commentsarray[2]="YEAH! You sock it to those monopolistic bastards!"; $commentsarray[3]="Hey, you're a wanker!";
And the code to write stuff is like this: <i> </i>$name=$_GET['name']; $_GET['comments'] = str_replace("n", "<BR />", $_GET['comments']); $comments=$_GET['comments']; $date=date("d/m/Y"); $time=date("g:ia");
And finally the code that prints it to the page. for($i=0; $i=$arraysize; $i+1) { print "This was posted by $namearray[$i] on $datearray[$i] at $timearray[$i]./n" print "$commentsarray[$i]/n" }
Yeah.. basically structured the same way as a js assignment I had to do once. ?
@BigMoosieApr 26.2005 — #I'm not an expert on PHP but I have doen similar things in JavaScript with cookies, what I would do is use whatever mehtod is similar to the escape() function in JavaScript and add the data to the end of the file like so:
*name*date*time*comments
*name2*date2*time2*comments2
(use whatever special character you want to separate the values);
to read from it then you take it as a string with PHP you can use a loop to set up new arrays from it and then a loop to display the data of the arrays.