I have a page with a form like so:
<form method="POST" action="scripts/save-settings2.php">
<div id="posts">
<div class="post">
<div>
<label for="siteName">Site Name</label>
<div class="input-wrap">
<input value="<?php echo constant('siteName'); ?>" type="text" name="siteName" />
</div>
</div>
<input type="submit" value="Save" />
<a href="posts.php" class="cancel">Cancel</a>
</div> <!--Post-->
</div> <!--Posts-->
</form>
The values of the inputs are sent to this script:
include '../includes/database-login.php';
if (isset($_POST['siteName'])) {
$siteName = mysql_real_escape_string($_POST['siteName']);
define("siteName", "$siteName");
header('Location: ../settings.php');
} else {
header( 'Location: ../newpost-error.php' );
}
What I am trying to do is take what the users fills into the siteName input field, and define it as the constant "siteName" so I can echo the constant elsewhere on the site. For some reason this isn't working. Have I made some obvious mistake here?