PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
$BName = @$_POST["btstnme"];
$fName = @$_POST["FirstName"];
$lName = @$_POST["LastName"];
$Adrs = @$_POST["Address"];
$Cty = @$_POST["City"];
$Ste = @$_POST["State"];
$zpc = @$_POST["ZipCode"];
$Phn = @$_POST["Phone"];
$CPh = @$_POST["Cell_Phone"];
$brn = @$_POST["Bank_Routing_Number"];
$ban = @$_POST["Bank_Account_ Number"];
$eml = @$_POST["email"];
// Set the string to be written to the file
$values = "Bznme: $BName\r\n";
$values = "Name: $fName $lName\r\n";
$values .= "ads: $Adrs\r\n";
$values = "cti: $Cty\r\n";
$values = "sta: $Ste\r\n";
$values .= "zpcd: $zpc\r\n";
$values .= "phnn: $Phn\r\n";
$values .= "cphnn: $CPh\r\n";
$values .= "bnkrn: $brn\r\n";
$values .= "bacn: $ban\r\n";
$values = "envml: $eml\r\n";
// Open the file for truncated writing
$fp = @fopen("organizer.txt", "a") or die("Couldn't open organizer.data for writing!");
$numBytes = @fwrite($fp, $values) or die("Couldn't write values to file!");
@fclose($fp);
echo "Wrote $numBytes bytes to organizer.txt successfully!";
?>
Notice this line $values .= "ads: $Adrs\r\n";
there seems to be a difference when the . is put in front of the $values. I have been trying for several hours, but I cant seem to get all values to write to the txt file. There seems to be a distinct difference between "$values" and "$values ." Can someone tell me what the "." does?? Thanks in advance.
Sir thanks for your fast reply. I have tried several variations of the $x you mentioned without success. Exactly where does the entry belong - as in the example below..??
Look at what you had before with the $values. Look at each = and each .= and ask yourself what is going to happen on that line of code. Will $values get set to something (=) or will something be added to it (.=)? Then decide what should happen, and make the changes as you think they should be made.
If this was something that was hard I'd just give the answer, but this is a fundamental of programming - not just with PHP - and you need to learn it if you're going to continue.
Teach a man to fish I got it. But you should know I have only been fishing for about 36 hours now. Quite frankly time is of the essence - can you assist...??
PHPNUStudent wrote:Guys forget it - I will try another forum...
Why not try learning the language first? As others have said, you're not going to learn anything if you get people to do the work for you. And I'd be surprised if people on other forums will give any more of an answer than you've already had here, seeing as most people share the opinion that its better to teach than to do.
edit:
not only that, but:
PHPNUStudent wrote:Can someone tell me what the "." does?? Thanks in advance.
you've actually had a very specific answer to that question, so what's your problem?