Saving a form to a text file using php.
Posted: Wed Apr 19, 2006 7:51 am
patrikG | Please use
and here's the PHP file that goes with it:
But when you fill out the forms it cant save both text boxes. Any ideas? 
patrikG | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Ok, here's my ultra basic HTML form:Code: Select all
<form action="connecttoserver.php?userid=$username&password" method="get">
<input type="text" name="username" size="24">
<input type="password" name="password" size="24">
<input type="submit">Code: Select all
<?php
$filename = "logfile.txt";
if (isset($_GET["username"]))
{
if (!$handle = fopen($filename, 'a'))
{
echo "Error while connecting to server";
exit;
}
else
{
if (fwrite($handle, "\r\n" . $_GET["username"]) === FALSE)
{
echo "Error while connecting to server";
exit;
}
}
echo "Error while communicating with 288.288.077.256";
fclose($handle);
exit;
}
echo "Error while connecting to server";
exit;
?>patrikG | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]