webdevdea Posted February 20, 2014 Share Posted February 20, 2014 (edited) I cannot understand why my background color is not changing when user selects it ?http://dandewebwonders.com/aliendata/response.php?username=Deanna&background=yellow&submit=Submit+Query <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> body { background-color: <?= $_GET['color'] ?>; } </style> </head> <body> Hello, <?= $_GET['username'] ?>! </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> option.red { background-color: red; } option.yellow { background-color: yellow; } option.blue { background-color: blue; } option.orange { background-color: #FF8040; } option.purple { background-color: #800080; } </style> </head> <body> <form action="response.php" method="get"> What is your name? <input type="text" name="username" size="20" /> <select name="background"> <option style="display:none;" selected="selected">color</option> <option class="red" value="red">Red</option> <option class="yellow" value="yellow">Yellow</option> <option class="blue" value="blue">Blue</option> <option class="orange" value="orange">Orange</option> <option class="purple" value="purple">Purple</option> </select> <input type="submit" name="submit" /> </form> </body> </html> Edited February 20, 2014 by webdevdea Quote Link to comment https://forums.phpfreaks.com/topic/286358-generate-html-page-from-php-user-input/ Share on other sites More sharing options...
requinix Posted February 20, 2014 Share Posted February 20, 2014 Because you named the input "background" and not "color"? Quote Link to comment https://forums.phpfreaks.com/topic/286358-generate-html-page-from-php-user-input/#findComment-1469780 Share on other sites More sharing options...
Solution webdevdea Posted February 20, 2014 Author Solution Share Posted February 20, 2014 I fugured it out, Because you named the input "background" and not "color"? Yes I had just figured that one out.. thank you so much !!!:-) Quote Link to comment https://forums.phpfreaks.com/topic/286358-generate-html-page-from-php-user-input/#findComment-1469781 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.