write to file PHP
i need to write to file (not on server, on PC) after submitting form.
for example this one:
syndoc.com/media/inde.php
so if you fill the form, press a submit button, it will add text of textboxes into file: C:\text.txt
I tried this code, but it doesn't work :(
please help!!!
<form method="post" action="inde.php">
<input name="a1" type="text" value="a1" />
<input name="b2" type="text" value="b2" />
<input name="c3" type="text" value="c3" />
<input name="d4" type="submit" value="d4" />
</form>
<?php
if (isset($_post['d4']))
{
$string = "<div>\n";
$string .= "<div>".$_post['a1']."</div>\n";
$string .= "<div>".$_post['b2']."</div>\n";
$string .= "<div>".$_post['c3']."</div>\n";
$string .= "</div>";
$fp = fopen('c:\text.txt', 'w');
if ($fp)
{
fwrite($fp,$string);
fclose($fp);
echo 'Data written ok..';
}
}
?> inde
for example this one:
syndoc.com/media/inde.php
so if you fill the form, press a submit button, it will add text of textboxes into file: C:\text.txt
I tried this code, but it doesn't work :(
please help!!!
<form method="post" action="inde.php">
<input name="a1" type="text" value="a1" />
<input name="b2" type="text" value="b2" />
<input name="c3" type="text" value="c3" />
<input name="d4" type="submit" value="d4" />
</form>
<?php
if (isset($_post['d4']))
{
$string = "<div>\n";
$string .= "<div>".$_post['a1']."</div>\n";
$string .= "<div>".$_post['b2']."</div>\n";
$string .= "<div>".$_post['c3']."</div>\n";
$string .= "</div>";
$fp = fopen('c:\text.txt', 'w');
if ($fp)
{
fwrite($fp,$string);
fclose($fp);
echo 'Data written ok..';
}
}
?> inde
