code help

My code doesnt seem to be working. its a registration code. Can anyone figure out the error?

<?php $fp = fopen("users.txt","a"); if ($fp == null){ die("Cannot open file"); } $str = '"'.$_POST['firstname'].'","'.$_POST['lastname'].'","'.$_POST ['street'].'","'.$_ POST['city'].'","'.$_POST['state'].'","'.$_POST['zip'].'","'.$_POST ['phone'].'"' ."rn"; fwrite($fp, $str); fclose($fp); echo "Registration completed"; ?>


Conference Registration

First Name Last Name

Street Address

Street Address 2

City State Zip


Can you provide some details about the error you are getting?

What is this: [‘street’].’","’.$_ ?

Paricularly the "Trailing "

I suspect you are using it to continue the command to the next line (such as in BASH Scripting) however, this is not necessary.

In PHP the semi-colon ; is the line terminator. Also you are attempting to split the line in the middle of a variable. Not 100% sure (but I am 99.98% sure) that you CANNOT separate the variable name. Breaks would need to be where there would otherwise be white space (tab, space, cr, etc…)

Sponsor our Newsletter | Privacy Policy | Terms of Service