Im using $_POST to submit to variables in my config file, but the problem is everytime I view the form, the fields are blank so it looks like the variables are empty.
Is their a way I can make the field default values be whatever is currently in the variables?. So for example if I edit the form and I add phpfreaks.com to the siteurl field, everytime I visit that form the default value of that field would be that? (unless changed).
My code:
<?php
include("config.inc.php");
echo "<form action='form.php' method='post' name='Form'>";
?>Website Url: (this edits $siteurl)<BR>
<input type="text" name="siteurl" size="25"><BR><BR>
Website Title: (this edits $site_title)<BR>
<input type="text" name="site_title" size="25"><BR><BR>
Your Email: (this edits $email)<BR>
<input type="text" name="email" size="25"><BR><BR>
<input name="submit" type="submit" value="Submit">
</form>
<?php
if(!empty($_POST["submit"]))
{
$out='<?php
//Website Url
$siteurl="'. (isset($_POST["siteurl"])? $_POST["siteurl"]:'') .'";
//Website Title
$site_title="'. (isset($_POST["site_title"])? $_POST["site_title"]:'') .'";
//Your Email
$email="'. (isset($_POST["email"])? $_POST["email"]:'') .";
?>';
file_put_contents("config.inc.php",$out);
}
?>
Thanks for your help