Jump to content

Kranti1992

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by Kranti1992

  1. Thanks, is what I'm doing the best way though, where the user 's request in a form changes the entire stylesheet or are there easier ways to change certain elements of the stylesheet based on user's input into a form? E.g. user types purple or chooses purple in drop down menu for font, and I use code to read that request and change the font of the currently linked stylesheet to purple?
  2. I know what you mean but: 1. The teacher says its ok to work with friends and get their ideas, i'm just trying to get ideas, and we are allowed to search online, it's just I can't find the answers I'm looking for. 2: The password question is not a necessity in my assignment, it's just one of the ideas I have (for creativitiy) and I want to know how it could be done, so I can consider looking into it. I really can't just "learn it myself" its too hard - I have no PHP experience and the class notes have basic "how to print using echo, using loops, arrays, etc" not specific techniques. Btw I have no friends to ask for help, they all seem to have done PHP before and consider me inferior:( This is what I've tried doing so far, mixing HTML with PHP: <!DOCTYPE HTML> <html lang=en> <head> <meta charset = "utf-8"> <title> Home </title> <link rel="stylesheet" href="stylesheet.css"/> <?php if(isset($_POST['font_color'])) { // variables $header = $_POST['font_color']; $purple = "purple"; $black = "black"; if(!empty($header) && $header == $purple) { ?> <link rel="stylesheet" href="stylesheet2.css"/> <?php } else if(!empty($header) && $header == $black) { ?> <link rel="stylesheet" href="stylesheet.css"/> <?php } } ?> </head> The above is linked to this form: <div id="form"> <form action="admin.php" method="post"> HEADER: <input name="header" type="text"/> <br/> FOOTER: <input name="footer" type="text"/> <br/> FONT TYPE: <input name="font_type" type="text"/> <br/> FONT COLOR: <input name="font_color" type="text"/> <br/> <input type="submit" value=" Submit "/> </div> So far it works it's just it doesn't link the style sheet forever, so if I change the font to purple or black it changes again when I refresh the page.. otherwise it works when I type "purple" in the font section of the form now etc. Thanks, Kranti
  3. So we just started php after learning a month of HTML, and we need to create a website with a page that allows the admin to change the colors and font size, header, etc on the webpage itself via forms. E.g. I'm on the site and I can use a drop down menu to change the background to "blue" for example. No need to go edit the CSS file or anything. How can be this done? My second and final question is how would I write code that allows my website to have users "log in" to their account so they can edit their page? Thanks a lot, I'm not good at PHP yet I've just started so please keep that in mind:) - Kranti
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.