I have this form that allows you to choose a background color and text color. Once this is submitted, I want the data to change my stylesheet. Can I do this without entering the values in a database? Here is my form:
<form method="post" action="blog_settings.php">
<label for="change_background_color">Change Background Color</label>
<br>
<input type="color" name="change_background_color" id="change_background_color">
<br>
<label for="change_text_color">Change Text Color</label>
<br>
<input type="color" name="change_text_color" id="change_text_color">
<br><br>
<input type="submit" value="Submit" id="submit" onclick="return confirm('Are you sure?')">
</form>
Here are my post values:
<?php
if (isset($_POST['change_background_color'])){
$change_background_color = $_POST['change_background_color'];
}
if (isset($_POST['change_text_color'])){
$change_text_color = $_POST['change_text_color'];
}
?>
Here's how I plan to alter my CSS:
body {
background-color: <?php echo $change_background_color ?>;
color: <?php echo $change_text_color ?>;
}
I know I'm missing a step here. Can I do this without entering the color values into a database?