Re: Open a file?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx> wrote in message
news:24971267.1148628659988.JavaMail.root@xxxxxxxxx
> 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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux