Answers for "change background color with user option"

PHP
0

change background color with user option

<form action="" method="post">

<select name="Color">
	<option value="White">White</option>
	<option value="Red">Red</option>
	<option value="Green">Green</option>
	<option value="Blue">Blue</option>
	<option value="Pink">Pink</option>
	<option value="Yellow">Yellow</option>
</select>

<input type="submit" name="submit" value="Get Selected Values" />

</form>
<?php

if(isset($_POST['submit'])){

	$selected_val = $_POST['Color'];  // Storing Selected Value In Variable
	echo "<style>body{background-color:".$selected_val.";}</style>";  // Displaying Selected Value

}

?>
Posted by: Guest on February-07-2021

Code answers related to "change background color with user option"

Browse Popular Code Answers by Language