Hey everyone, I need to make a string from a list of predefined static text and variables. This will be used to generate a config.php script for my new script. Basically here is where I am at: $config = "<?php $dbname = ".$enteredname."; $dbuser = ".$entereduser."; $dbpass = ".$enteredpass."; ?>"; for the page before this I have a form that saves the variables $enteredname, $entereduser, and $enteredpass. In that string $config, the only strings I want replaced are the "entered" ones from my form. The others I actually want to leave as plain text for my config.php page is right. Any ideas?
try this $config = "<?php\n\t\$dbname = \"".$enteredname."\";\n\t\$dbuser = \"".$entereduser."\";\n\t\$dbpass = \"".$enteredpass."\";\n?>"; PHP:
No go, when using that syntax, the output of the page leaves me with a config.php files that contains: <?php $dbname = ""; $dbuser = ""; $dbpass = ""; ?> PHP:
the formats right, im guessing you need to change the "entered" variables to pull from the previous form... i.e $_POST["name"] etc