Category "php"

How to submit a form when page loads using JavaScript?

I know this question has been answered many times but in my case the JavaScript code creates a infinite loop which makes my page load continuously, <script t

How to properly set "0000-00-00 00:00:00" as a DateTime in PHP

I have a column viewedAt which is a DATETIME and accept NULL values. It's a software restriction to set that column on each new record as 0000-00-00 00:00:00 so

Laravel 5.1 xmlHttpRequest AJAX POST TokenMismatchException

The relevant code is shown below: var csrfToken = "{{ csrf_token() }}"; xmlhttp.open("POST", "/internal/v1/create/strategy", true); xmlhttp.setRequestHeader('X

how to get the header value, if we don't know the value because the value is random from the server

For example: header name "alphabet" alphabet: abcde next request the value changes from the server alphabet: jkfrts and then continue to change

Wordpress : Load the whole Page using AJAX

I currently using Oxygen Builder in my wordpress, tryna load my other page using AJAX and I'm very very noob at this. Then, i've done some research about it fir

how to check if a string of a number has 10 characters in php

I am struggeling at implementing a check on a textbox. I want to check if the phone number has a length of 10 characters, contains my country base number and if

Swoole process is hanging forever

I have the simplest Swoole code, which sleeps for a second and prints "Run task" message to the screen. <?php namespace Tests\Util; use PHPUnit\Framework\T

Laravel 5.1 how to use {{ old('') }} helper on blade file for radio inputs

I'm currently learning laravel and creating my first form. Everything is awesome until I want to use {{ old('') }} helper in my blade file for radio buttons. I'

PhpStorm and PSR-12, how can I add it as default coding style?

PSR-12 is an extension of PSR-2, and therefore also an extension of PSR-1. The basis of PSR-12 is PSR-2 and therefore a list of differences is provided b

Additional price based on cart item count in WooCommerce

Based on "woocommerce change price in checkout and cart page" answer code that change the total price in checkout page, I have added some extra code to count th

Convert string to lowercase AND then convert it to its original form in PHP, is it possible?

I need to convert input data to lower and then return it in it's original form with PHP, is it impossible or does anyone have a solution? thank you. ps, i'm

Note: Enabling the database statistics here might cause heavy traffic between the web server and the MySQL server

Note: Enabling the database statistics here might cause heavy traffic between the web server and the MySQL server. I got this error when I tried to add a

Group rows by column and sum another column within groups [duplicate]

I have an array looking like: array(480) { [0]=> array(2) { ["tag_id"]=> string(4) "6291" ["az"]=> int(5) } [

Woocommerce shipping address is empty

the option on the site "Default to customer billing address" is selected but the shipping address is still empty. I tried to fix it with code add_action( 'w

Clients authentication and user authentication with laravel

I am working on api, where I have the following models. Merchant -> hasMany -> Shops Shop -> hasMany -> Customers Each merchant will have api tok

Facebook PHP SDK - "Please close this tab to continue" error in iOS

I'm using the PHP SDK (v5.0) to log users into my site, using the basic code from Facebook's docs (I filled in and/or changed the necessary parts for my website

How to skip cart page on woocomerce for certain products only?

I added this to my functions.php file : add_filter ('woocommerce_add_to_cart_redirect', 'woo_redirect_to_checkout'); function woo_redirect_to_checkout() { $che

Filter WooCommerce products with post__in and additional meta queries

I am trying to find products that are on sale (including product variations) in addition to another meta_query of price under X. The wc_get_product_ids_on_sale(

Unable to match results of php hash_hmac() and coldfusion hmac()

I am working on encrypting a URL and converting a working script from PHP to ColdFusion. I have completed 95% of the work but I am stuck at this point after try

PhpSpreadSheet: How to save Workbook sheets in individual CSV files

I'm using PhpSpreadSheet and I need to save the sheets contained in a workbook as individual CSV files. I've tried to use $reader->setLoadAllSheets(); but