0

Well I want stylesheet URLs to be stored in the database, and change the stylesheets href by variables in html tags.

But nothing happen when i using this code:

 global $theme_addresss;
    global $showdetail_dbtadbirusers;
    require 'displaycustomersdb.php'; /*this file store usercode in variable via session*/
    $sql_changetheme = mysqli_query($link, "SELECT profile_theme FROM tusers WHERE usercodecode='{$usercodecode}'");
    $sql_result_changetheme = mysqli_fetch_array($sql_changetheme);
   $theme_addresss = $sql_result_changetheme['profile_theme'];

<link rel="stylesheet" href='<?php  echo $theme_addresss; ?>'>
6
  • Are you trying to include single css file or multiple? Commented May 1, 2019 at 5:31
  • Can you inspect the result and see what it is? Commented May 1, 2019 at 5:35
  • Yes i have 3 css file that their addressees store in users table, then i want css file address store in variable and i put that variable into HTML tag. if i can fix this problem then i'll use swich case. Commented May 1, 2019 at 5:37
  • @YaakovAinspan When i echo variable it's working and show data. but it's not working when i put variable into the html tag. Commented May 1, 2019 at 6:01
  • 1
    You have an extra $ sign in global $$theme_addresss. Commented May 1, 2019 at 6:08

2 Answers 2

1

I find out what is the problem, the code is fine. i just put <link rel="stylesheet" href="<?php echo $theme_addresss; ?>"> into the other page of my website and it worked!

Sign up to request clarification or add additional context in comments.

Comments

0

Can you try change single quote to double quote around href and see if it works?

<link rel="stylesheet" href=“<?php echo $theme_addresss; ?>”>

1 Comment

not working, it's only working when i insert css address into variable. like: echo $theme_addresss="css/style.css";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.