It's strange to add data to the notepad and use t to split it. why is the length of each tab key inconsistent? Inconsistent? It's strange to add data to the notepad and use \ t to split it. The result is displayed in the notepad. are the tabs of different lengths different?
See figure
Reply to discussion (solution)
Someone answered?
The source code is as follows: two files, one for data submission and one for data processing.
Order Results
Bob's auto Parts
Order Results
Echo"
Order Precessed ";
Echo date ('H: I, jS f ');
Echo"
";
?>
$ Totalqty = 0;
Print_r ($ _ POST );
Echo"
";
$ Tireqty = $ _ POST ['tireqty '];
$ Oilqty = $ _ POST ['ilqty '];
$ Sparkqty = $ _ POST ['sparkqty '];
$ Address = $ _ POST ['address'];
$ DOCUMENT_ROOT = $ _ SERVER ['document _ root'];
$ Totalqty = $ tireqty + $ oilqty + $ sparkqty;
$ Date = date ('H: I, jS FY ');
Echo "Item Ordered: $ totalqty
";
If ($ totalqty = 0 ){
Echo "You did not order anything on the Bob's site! ";
} Else {
If ($ tireqty> 0 ){
Echo $ tireqty. "tireqty
";
}
If ($ oilqty> 0 ){
Echo $ oilqty. "oilqty
";
}
If ($ sparkqty> 0 ){
Echo $ sparkqty. "sparkqty
";
}
}
$ Totalamount = 0.00;
Define ('tireprice', 100 );
Define ('oliprice ', 10 );
Define ('sparkprice', 4 );
$ Totalamount = $ tireqty * TIREPRICE
+ $ Oilqty * OLIPRICE
+ $ Sparkqty * SPARKPRICE;
$ Totalamount = number_format ($ totalamount, 2 ,'.','');
Echo"
Totalamount is $ ". $ totalamount ."
";
$ Tax_rate = 0.1;
$ Totalamount = $ totalamount * (1 + $ tax_rate );
Echo "Total including tax: $". $ totalamount ."
";
$ Putstrings = $ date. "\ t ". $ tireqty. "tires \ t ". $ oilqty. "oil \ t ". $ sparkqty. "spark plugs \ t ". "Totalamount $ ". $ totalamount. "\ t ". "Address ". $ address. "\ r \ n ";
Print_r ($ DOCUMENT_ROOT );
@ $ Fp = fopen ("$ DOCUMENT_ROOT/../orders/order.txt", 'AB ');
Flock ($ fp, LOCK_EX );
If (! $ Fp ){
Echo"
Your order is not processed at this time.
Please try again later.
";
Exit;
}
Fwrite ($ fp, $ putstrings, strlen ($ putstrings ));
Flock ($ fp, LOCK_UN );
Fclose ($ fp );
Echo "Order Written! ";
?>
This is a problem with notepad. you can use notepad ++ or another editor to open a text file.
This is related to the number of spaces equal to tab. Notepad looks like 8.