Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Undefined Variable and CSS not updating

Hi im new to stackoverflow and php I have made a custom external css everytime when I try to change the color of something it doesn’t update but if I got on another device it is there half of the time. Why is it doing this?

I also have undefined variable $seconddata
if someone can help

$first = '<a class="info">Test</a>'
$secondData = '<a>info</a>'
echo $first;
echo $seconddata;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Since you said that other devices get the update and not your pc it is safe to assume your browser is caching your files, if you are in chrome you can open developer tools, hold down on the refresh button next to the url bar and then press Empty Cache and Hard Reload.
Alternatively what you can do to bypass caching in html is add a parameter to your css url and change it each time you want to release a css update or automatically change it with a php variable that changes each time you load the page, example below.

<link type="text/css" rel="stylesheet" href="yourcss.css?<?php echo date('h:i:s'); ?>" />

As for the undefined variable $seconddata, it is because you are defining $secondData with a capital D and you are trying to call it with a lower case d. Use this code below.

$first = '<a class="info">Test</a>'
$secondData = '<a>info</a>'
echo $first;
echo $secondData;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading