What's New

CSS: Submit button looks smaller than input and textarea (solved)

input, textarea, .button_style { 
box-sizing: border-box;
-moz-box-sizing: border-box;

When your <button> or <input type=”submit”> looks smaller than the input fields or textarea, just use the code I used above this text and see the results: the submit/button looks the same size as the other form fields.

PHP Explode() example

This function is extremely useful when you need to deal with url variables that you need to explode and use the separately. Let me give you a simple example: you have the following url – https://example.com/archive/2021-02-10/diesel/

Sometimes you need to use the date in the url and other times you need to move the year at the back of the string to use it in another way somewhere in your code.

We can use the PHP explode() function to do this… but first, you need to get the url as a string, you can use this article to learn how to do that – Get actual link of website PHP, after you have the url, you need to isolate the exact string to use it separately.

In our study case we will use the variable in the url that you can get it by accessing $_GET[‘variable_name’].

After we have the $_GET var, we will use the explode function:

$gm = $_GET['var'];

$gx = explode("-", $gm);

$gw   = $gx[2]."_".$gx[1]."_".$gx[0];

You can see this example in action here: php explode(); example

PHP + MySQL + jQuery = fuel-prices.eu

I developed fuel-prices.eu as a side project using data from the Weekly Oil Bulletin provided every week(or almost) by the European Commission. PHP and MySQL helped me with the back site work and chart.js helped me a lot with the chart and data representation of the Diesel and Euro-Super 95 data flows.

The data range is from 2015 inclusive to our present week.

I also have in plan to add to the database all of the data beginning from 2009, that means a lot of PHPmyAdmin work for me in the next future.

For more informations about this project you can contact me.

.htaccess – force trailing slash for url

This little .htaccess code does the trick on solving the SEO problem of bad url’s… let’s say that you have a https://www.example.com/images/ url that works ok, but someone forgets to add the last trailing slash and he/she accesses the https://www.example.com/images that, normally gives you a 404 error page and not the real stuff like photos and videos…

You just need to add this little code to your .htaccess file and if anyone forgets to add the last / after the url, it will be forced redirected to the right url with the / at the end.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ /$1/ [L,R=301] 

Get actual link of website PHP

$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";


echo $actual_link;

Security headers for .htaccess

Header always set Strict-Transport-Security: "max-age=31536000" env=HTTPS 
Header always set Content-Security-Policy "upgrade-insecure-requests"
Header always set X-Content-Type-Options "nosniff"
Header always set X-XSS-Protection "1; mode=block"
Header always set Expect-CT "max-age=7776000, enforce"
Header always set Referrer-Policy: "no-referrer-when-downgrade"

jQuery toggle both content and button

<script src="//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

<script type="text/javascript">
$( ".sod" ).click(function() {
  $( ".sods" ).toggle(function() {
    $( ".blo" ).toggle("slow");



Display as you type input value in div and input type populate with the same text with jQuery

Some situations need a special way of thinking regarding functionality and automation.

This little script sends the text typed in a form/input type to a div and also to another input type so that you can use in many ways the final result – the POST or GET variable created. Also the fist input type works with its defined name.

You can see a working demo here: DEMO