[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Re: php variablen printer ikke



Nå nu prøvede jeg lige at tage udgangspunkt i et andet "code example" og tilpasse den og denne gang virker det faktisk. Jeg er ikke i stand til at sige hvad den grundlæggende forskeld er men det her virker tilsyneladende. Indholdet af name bliver skrevet til fil når jeg trykker submit (prøv selv :-))

formen:
http://www.mimoart.ooz.dk/fwrite.php

check resultatet i:
http://www.mimoart.ooz.dk/test.txt

<?php
$filename = 'test.txt';
$somecontent = "Add this to the file\n";
$text1 = "Dette er indholdet af variablen text1";
$name = $_POST['name'];
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {

   if (!$handle = fopen($filename, 'w')) {
        echo "Cannot open file ($filename)";
        exit;
   }

   // Write $name to our opened file.
   if (fwrite($handle, $name) === FALSE) {
       echo "Cannot write to file ($filename)";
       exit;
   }
	fclose($handle);

} else {
   echo "The file $filename is not writable";
}
?>
<html>
<head>
<title>This will be your Page's title</title> <!- You can change the title, set whatever you want ->
</head>
<body> <!- Printing on page starts from here ->
<!- This is a comment and will not be printed on page ->
<form action="" method="POST">
Name: <input type="text" name="name" /> <br />
<input type="submit" name="submit" value="submit" />
</form>
<?php echo $text1; ?> her <br>
</body>
</html>




 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2010-09-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *