Hejsa.
Jeg vil gerne skrive en fil. Den laver filen fint.
Og skriver en del af koden.
Her er min write.php file.
- <?php
- // Hent stage3.php
- include("stage3.php");
-
- $hostname = $_POST['mysqlhost'];
- $username = $_POST['mysqlusername'];
- $password = $_POST['mysqlpassword'];
- $database = $_POST['mysqldatabase'];
-
- // Lav en config.php fil. Som kan oprette forbindelse til MySQL serveren.
- $string = '<?php
- $dbhost = "'. $hostname .'";
- $dbuname = "'. $username. '";
- $dbpass = "'. $password . '";
- $dbname = "'. $database . '";
- ?>';
-
- $fp = fopen("config.php", "w");
- fwrite($fp, $string);
- fclose($fp);
-
- ?>
Den skriver f.eks.
$dbhost = "";.
Men ikke selve $hostname. Den er bare blank.
Min stage3.php ser sådan her ud.
Jeg trykker på min "Save" knap.
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <html>
- <body>
- <img src="images/header.jpg">
- <link rel="stylesheet" href="background.css" type="text/css" />
- <link rel="stylesheet" href="install.css" type="text/css" />
- <h1>
- Please fill in below:
-
- <form action="checkmysql.php" method="post">
- <p>MySQL Hostname: <input type="text" id="mysqlhost" name="mysqlhost"></p>
- <p>MySQL Username: <input type="text" id="mysqlusername" name="mysqlusername"></p>
- <p>MySQL Password: <input type="password" id="mysqlpassword" name="mysqlpassword"></p>
- <p>MySQL Database: <input type="text" id="mysqldatabase" name="mysqldatabase"></p>
- <input type="Submit" name="checkmysql" value="Check MySQL">
- </form>
- <form action="savemysql.php" method="post">
- <input type="Submit" name="savemysql" value="Save">
- </form>
- </h1>
- <br>
- <img src="images/footer.jpg">
- </body>
- </html>
Mange hilsner,
- Magnus.
Indlæg senest redigeret d. 31.08.2009 19:53 af Bruger #15047