Re: Open a file?
| From: | The Panister | Date: | Wed, 31 May 2006 20:25:41 +0000 |
| Subject: | Re: Open a file? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-41964@lists.php.net to get a copy of this message | ||
Well....
You may try this:
First you can make a form and add the option to write to the file hidden in
the form... just like that:
<form method="post" action="Action_File.php">
<input type="hidden" name="theText" Value="The Page has been visited at
<?php
$today = getdate();
print_r($today);
?> " > <br>
<input type="submit" value="Post Data">
</form>
-----------------------------------------
Then the Action File should be contain some thing like that:
<?php
// Here we get the information in about when the page visited.
$theText = $_POST["theText"];
$theText = stripslashes($theText);
// Here we open the file... Of course you will change the $filename with
the name of your file that you want the text to be written in it.
$data = fopen($filename, "a");
// And here we write the data.
fwrite($data,$theText);
// And here we close the file.
fclose($data);
?>
That's All.
Of course you can modify and enhance the code to meet your needs
I wish this help you.
The Panister!
Wim Van Geyt <wim.vangeyt@hotmail.com> wrote in message
news:24971267.1148628659988.JavaMail.root@pumbaa...
> Hi,
>
> I want to send a choice to a textfile in php.
> Now i don't know how to let the button communicate with the php script?
> And do i have to write the script in the same page as the page where i
have writed the radiobuttons?
>
> Does anyone knows an answer ?
>
> Thanks
> Crazydj
> -----------------------------------------------------
> Mail.be, WebMail and Virtual Office
> http://www.mail.be