PHP

Saving dynamic page content in a static HTML file functionality is used for many purposes, page caching system is one of them. In the caching system, the dynamic data is stored in an HTML file and displays the content from the HTML file to make the page load faster. In this example code snippet, we will show you how to save output of a PHP file in an HTML file and store dynamic page content in an HTML file using PHP.

By: CodexWorld Aug 30, 2023

The window.print() method is the easiest solution to print HTML content in JavaScript. The Window print() method opens the browser’s default print dialog to print the current document. You can use this method to print dynamic HTML content using JavaScript. By default, the page orientation is set to portrait in the print dialog. You can change page orientation in the print dialog by adding CSS to the document header.

By: CodexWorld Aug 16, 2023

Whenever a form is submitted or completed a task, the status message is displayed on the web page. It will be a great idea to hide the message DIV after some seconds automatically from the element. Use fadeTo() method to hide DIV element after some time interval using jQuery. Not only DIV element, you can autohide any HTML element after few seconds in jQuery.

By: CodexWorld Aug 2, 2023

It’s always recommended for developers to use dynamic year in the copyright section so that the year can be changed automatically and updated with the current year. You can get the current year and add the dynamic year in HTML using JavaScript. Create a Date object and call the getFullYear() method to get the current year in JavaScript.

By: CodexWorld Jul 24, 2023

It’s always a good idea to add client-side validation before uploading file to the server. The client-side validation adds a great user experience to the file upload section. The file size validation can be added to the file upload field using JavaScript and jQuery. In this example code snippet, we will show you how to validate file size while uploading file using jQuery or JavaScript.

By: CodexWorld Jul 7, 2023

If autocomplete is on in the browser, the input value is filled automatically based on the previously entered values. The autocomplete feature mostly works for the username, email, and password inputs which are saved in the browser. It is possible to turn off autocomplete for form or specific input fields. The autocomplete attribute helps to specify whether form inputs should have autocompletion on or off.

By: CodexWorld Jul 4, 2023

When the input is given by the user, it is always a good idea to filter and validate the input before processing. You can filter input string as per the required data type with PHP. In this example code, we will show you how to get only alphanumeric characters from string in PHP. Use PHP preg_replace() function to remove everything except a-z, A-Z, and 0-9 from the string.

By: CodexWorld Jun 23, 2023

Generally, a text input element is used in the HTML forms to accept the user’s input. The user can input alphanumeric and special characters in this text input field. In some specific cases, you are required to allow the user to input only alphabets, and restrict them to input numeric and special characters. In this example code snippet, we will show you how to allow only alpha letters or characters in the input element with HTML.

By: CodexWorld Jun 22, 2023
PHP

String encryption functionality is used to make sensitive information safe in the web application. With the encryption feature, the original string is encrypted with Salt/Key and stored. Later the encrypted string is decrypted by the Salt/Key that is used at the time of encryption. The encryption and decryption algorithm can be implemented with a salt key using PHP.

By: CodexWorld May 19, 2023
keyboard_double_arrow_up