Forum Moderators: coopster

Message Too Old, No Replies

Editing a settings.php file trhough an online form.

Can't get variables to display...

         

sauce

8:30 pm on Nov 13, 2005 (gmt 0)

10+ Year Member



I'm trying to write a form to call varibales from my settings.php file and be able to edit them from an online form...

The settings.php contains these 3 vars.. $sitename, $email, $url...

Here is the editor code:

<?php
$loadcontent = "settings.php";
if($save_file) {
$savecontent = stripslashes($savecontent);
$fp = @fopen($loadcontent, "w");
if ($fp) {
fwrite($fp, $savecontent);
fclose($fp);
}
}
$fp = @fopen($loadcontent, "r");
$loadcontent = fread($fp, filesize($loadcontent));
$loadcontent = htmlspecialchars($loadcontent);
fclose($fp);

?>
<form method=post action="<?=$_SERVER[PHP_SELF]?>">
Site name: <input name="savecontent" type="text" value="<?=$sitename?>" size="70">
Email: <input name="savecontent" type="text" value="<?=$email?>" size="70">
URL: <input name="savecontent" type="text" value="<?=$url?>" size="70">
<br>
<input type="submit" name="save_file" value="Save">
</form>

henry0

9:47 pm on Nov 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Didn't you forget to describe your problem?

at first sight
what are for the " = " after " <?

for example in:
="<?=$_SERVER[PHP_SELF]?>">

as is $_SERVER will not perform as expected!
as well as the others
try removing the equal sign after: <?

<edit> Sorry! I found your question in the sub-title</edit>