I cannot seem to figure out why my order.txt file is blank despite seemingly having my logic correct. I'm new to PHP, so I apologize if I have obvious syntax errors.
I'm attempting to log the user input values of a form to a .txt file once the submit button is clicked. Here is my code: NOTE: both my form and php script are in the same file, so the action is referring to itself.
HTML:
<form action="p1_checkout.php" method = "POST">
First name:<br>
<input type="text" name="firstname"><br>
Last name:<br>
<input type="text" name="lastname"><br>
Street Address:<br>
<input type="text" name="streetaddress"><br>
City:<br>
<input type="text" name="city"><br>
State:<br>
<input type="text" name="state"><br>
Zip Code:<br>
<input type="text" name="zipcode"><br>
Phone Number:<br>
<input type="text" name="phonenumber"><br>
Order Quantity:<br>
<input type="text" name="orderquantity"><br>
<input type="submit" value="Checkout">
</form>
PHP:
<?php
$newfile = fopen("order.txt", "w+");
$fproduct = "Product: Mount Diablo, California Print";
$fqty = "Quantity Ordered: ".$_POST['quantityordered'];
$fname = "Person Billed: ".$_POST['firstname'];
$faddress = "Address: ".$_POST['streetaddress'] + "," + $_POST['city'] + "," + $_POST['state'] + "," + $_POST['zipcode'];
$fcontent = $fproduct + $fqty + $fname + $faddress;
fwrite($newfile, $content);
fclose($newfile);
?>