I've been making a program for school there is nothing wrong with the program itself except I don't know how to add line breaks inside a fwrite command.
I'll show the code below so I can explain a little easier.
The part in bold is where I need line breaks, any advice would be great.
<html>
<body>
<form action="IO1.PHP" method="post">
<p>
<label for="StrAccount"><b>Account:</b></label>
<input type="text" name="StrAccount" id="StrAccount" />
<input type="submit" name="submit"/>
</p>
<?PHP
/* Customers Information */
$Customer[0] = "Luiz InĂ¡cio Lula da Silva";
$Customer[1] = "J.T. Wang";
$Customer[2] = "Admiral Mike Mullen";
$Customer[3] = "Barack Obama";
$Customer[4] = "Ron Bloom";
$Phone[0] = "1234 5678";
$Phone[1] = "5678 1234";
$Phone[2] = "0000 1234";
$Phone[3] = "1234 0000";
$Phone[4] = "0000 0000";
$Title[0] = "The Shawshank Redemption";
$Title[1] = "The Godfather";
$Title[2] = "The Godfather: Part II";
$Title[3] = "Inception";
$Title[4] = "Sergio Leone's The Good, the Bad and the Ugly";
$Cost[0] = "$1.00";
$Cost[1] = "$2.00";
$Cost[2] = "$3.00";
$Cost[3] = "$4.00";
$Cost[4] = "$5.00";
$Return[0] = "01/01/2010";
$Return[1] = "01/02/2010";
$Return[2] = "01/03/2010";
$Return[3] = "01/04/2010";
$Return[4] = "01/05/2010";
if (isset($_POST["submit"]))
{
$Text = fopen ("Customers.txt", 'w');
$StrAccount = $_POST["StrAccount"];
if ($StrAccount == $Customer[0])
{
echo "<p><b>$Customer[0], $Phone[0], $Title[0], $Cost[0], $Return[0]</b></p>";
fwrite ($Text, $Customer[0]);
fwrite ($Text, $Phone[0]);
fwrite ($Text, $Title[0]);
fwrite ($Text, $Cost[0]);
fwrite ($Text, $Return[0]);
}
elseif ($StrAccount == $Customer[1])
{
echo "<p><b>$Customer[1], $Phone[1], $Title[1], $Cost[1], $Return[1]</b></p>";
fwrite ($Text, $Customer[1]);
fwrite ($Text, $Phone[1]);
fwrite ($Text, $Title[1]);
fwrite ($Text, $Cost[1]);
fwrite ($Text, $Return[1]);
}
elseif ($StrAccount == $Customer[2])
{
echo "<p><b>$Customer[2], $Phone[2], $Title[2], $Cost[2], $Return[2]</b></p>";
fwrite ($Text, $Customer[2]);
fwrite ($Text, $Phone[2]);
fwrite ($Text, $Title[2]);
fwrite ($Text, $Cost[2]);
fwrite ($Text, $Return[2]);
}
elseif ($StrAccount == $Customer[3])
{
echo "<p><b>$Customer[3], $Phone[3], $Title[3], $Cost[3], $Return[3]</b></p>";
fwrite ($Text, $Customer[3]);
fwrite ($Text, $Phone[3]);
fwrite ($Text, $Title[3]);
fwrite ($Text, $Cost[3]);
fwrite ($Text, $Return[3]);
}
elseif ($StrAccount == $Customer[4])
{
echo "<p><b>$Customer[4], $Phone[4], $Title[4], $Cost[4], $Return[4]</b></p>";
fwrite ($Text, $Customer[4]);
fwrite ($Text, $Phone[4]);
fwrite ($Text, $Title[4]);
fwrite ($Text, $Cost[4]);
fwrite ($Text, $Return[4]);
}
else
{
echo "<p><b>This Account Does Not Exist.</b></p>";
}
}
?>
</body>
</html>