ChrisElliott
-
Posts
4 -
Joined
-
Last visited
Posts posted by ChrisElliott
-
-
I've tried this with $_COOKIE and $_POST and got the same result.
-
I've been struggleing with this problem for a little while now. I tried Paul's code suggestion, but it isn't working for me still. Can anyone tell me what I'm doing wrong?
<form action = "customize.php" method="post"> <select name="font_size"> <option value="">Font Size</option> <option value="xx-small" <?php if (isset($_POST['font_size']) && $_POST['font_size']=="xx-small"){print "selected=selected";} ?> >xx-Small</option> <option value="x-small" <?php if (isset($_POST['font-size']) && $_POST['font-size']=="x-small"){print "selected=selected";} ?>>x-small</option> <option value="small" <?php if (isset($_POST['font-size']) && $_POST['font-size']=="small"){print "selected=selected";} ?>>small</option> <option value="medium" <?php if (isset($_POST['font-size']) && $_POST['font-size']=="medium"){print "selected=selected";} ?>>medium</option> <option value="large" <?php if (isset($_POST['font-size']) && $_POST['font-size']=="large"){print "selected=selected";} ?>>large</option> <option value="x-large" <?php if (isset($_POST['font-size']) && $_POST['font-size']=="x-large"){print "selected=selected";} ?>>x-large</option> <option value="xx-large" <?php if (isset($_POST['font-size']) && $_POST['font-size']=="xx-large"){print "selected=selected";} ?>>xx-large</option> </select> <select name="font_color"> <option value="" selected = "selected">Font Color</option> <option value="999" <?php if (isset($_POST['font-color']) && $_POST['font-color']=="999") {print "selected=selected"; } ?> >Gray</option> <option value="0c0" <?php if (isset($_POST['font-color']) && $_POST['font-color']=="0c0") {print "selected=selected"; } ?> >Green</option> <option value="00f" <?php if (isset($_POST['font-color']) && $_POST['font-color']=="00f") {print "selected=selected"; } ?> >Blue</option> <option value="c00" <?php if (isset($_POST['font-color']) && $_POST['font-color']=="c00") {print "selected=selected"; } ?> >Red</option> <option value="000" <?php if (isset($_POST['font-color']) && $_POST['font-color']=="000") {print "selected=selected"; } ?> >Black</option> </select> <input type="submit" name="submit" value="Set My Preferences" /> </form>
When I run this code, it doesn't seem to do anything different...it doesn't appear to be sticky.
-
I've read through this thread but I'm still not sure what the goal of this Pursue problems is supposed to be. It says to rewrite it so that the "script also applies the user's preferences". Can anyone clarify this for me. What should the end result look like? I mean, I see the code you wrote out, Larry, but I'm not sure what it is actually supposed to do. When I run my scripts, I see no difference.
Question Re Exercise From Chapter 9
in PHP for the Web: Visual QuickStart Guide (4th Edition)
Posted
I figured out that I was trying to use font-size and font-color instead of font_size and font_color.
Thanks for your help, Larry.