Inserting PHP variables into a PHP document using fwrite?

I am using the below code in order to try and write >Update:

From the config.php file that is to be written to (it's empty on start), I get:

='localhost'; ='alex2049_name'; ='alex2049_user'; ='pass';

How do I get it so the $variables get included in this text file too, for purposes of being included?

Comments

  • The problem is that the $user etc inside the double quoted strings are being expanded, and the variables are empty.

    You probably want

    $stringdataone = "\$host='" . $_POST['host'] . "'; ";

    note the backslash, to prevent PHP interpreting $host as a variable where you do not want it to.

  • What you're doing as we communicate might want to be assigning $author to the $call variable. once you assign it, you're basically assigning non declared variable. $author does no longer exists even as it really is being assigned to the variable. i desire you realize what i'm attempting to assert. anyhow right it truly is the fix: $author = 'H.G. Wells'; $call = 'The warfare of the Worlds' . $author; P.S: also you forgot semicolon (;) on the end of the $author variable.

Sign In or Register to comment.