No claro, esto esta mal, mira
Esto va joya
Código HTML:
<!-- mira el action -->
<form action="algo.php" method="post" enctype="multipart/form-data" >
<p>host
<input value="<? echo "$dbhost"; ?>" name="dbhost" type="text" >
<br>
usuaro
<input value="<? echo "$dbuser"; ?>" name="dbuser" type="text" >
<br>
contraseña
<input value="<? echo "$dbpass"; ?>" name="dbpass" type="password" >
<br>
base de datos
<input value="<? echo "$db"; ?>" name="db" type="text">
</p>
<p>
Titulo web<input value="<? echo "$webtitulo"; ?>" name="webtitulo" type="text" >
</p>
<input class="form" name="enviar" type="submit" value="Guardar">
</form>
Te haces un archivo aparte que se llame "algo.php" y que sea asi:
Código PHP:
#Hacete alguna comprobacion aca
# Aca escapa las comillas como hiciste antes
$string = '<?php';
$string .= '$user = '.$_POST['dbuser'].';';
$string .= '$pass = '.$_POST['dbpass'].';';
$string .= '$host = '.$_POST['dbhost'].';';
$string .= '$dbName = '.$_POST['db'].';';
$string .= '$webtitulo = '.$_POST['webtitulo'].';';
$string .= '?>';
$fp = fopen('config.php', 'w+');
fwrite($fp, $string);
fclose($fp);
# Redireccionas a algun lado =P
header('location:algunLado.php');