i am trying to export the results from a form into the script of another php in form of variables :
ex.
form proccess script (globalvar.php)
$dbtype = $_POST;
$dbhost = $_POST;
$dbname = $_POST;
$dbpass = $_POST;
$dbport = $_POST;
$dbtable = $_POST;
new php (varheader.php)
$dbtype = 'mysql' ;
$dbhost = 'localhost' ;
$dbname = 'rootusername' ;
$dbpass = 'rootpassword' ;
$dbport = '10985' ;
$dbtable = 'script' ;
i wrote this script to accomplish that and to completely write the php script:
//set up vars for file open scripts
$fpvars = fopen("varheader.php", 'w');
//set up vars for output scripts
//database
$dboutput = "//database vars \n"."dbtype = '".$dbtype."'; \n". "dbhost = '".$dbhost."'; \n"."dbtype = '".$dbtype."'; \n"."dbname = '".$dbname."'; \n"."dbport = '".$dbport."'; \n"."\n". "database = array($dbtype, $dbhost, $dbname, $dbpass, $dbport);";
//phptags
$starttag = "<?php";
$blankline = "\n";
$closetag = "\n"."?>";
fopen("varheader.php", 'w');
fwrite($fpvars, $starttag, strlen($starttag));
fwrite($fpvars, $blankline, strlen($blankline));
fwrite($fpvars, $dboutput, strlen($dboutput));
fwrite($fpvars, $blankline, strlen($blankline));
fwrite($fpvars, $closetag, strlen($closetag));
it succsessfully writes the document but does this:
<?php
//database vars
mysql = 'mysql' ;
localhost = 'localhost' ;
rootusername = 'rootusername' ;
rootpassword = 'rootpassword' ;
10985 = '10985' ;
script = 'script' ;
?>
can anyone help?