I’m trying to create a shortcode for use in WordPress, that will allow me to use PHP and HTML functionality. I have created the shortcode and it works using simple echo Hello World, but when I try to …
Tag: php
Getting Values from Laravel drop-down form
I have a simple drop-down in a form. The form is: In the view function in the controller the array is: The store function in the controller is: The method, however, stores the position of the values instead of the value itself. So, if I do a dd(request()->all());, I get: How can I get the values instead of…
How to connect wss via ReactPHP components
I have a URI that works well with a js implementation, built as: “wss://domain” When I want to implement a subscriber for this socket as below: $loop = Factory::create(); $…
Choose multiple data from datalist dropdown
I have this datalist, and right now I can only choose a signle variable, and this variable is sent with a form, and used in a sql query. But my users want to be able to pick multiple data from the datalist, but how can this be done? Can it be done by a checkbox for each option or? Part
Using ternary operator in echo?
How come I can use echo like this: But can’t use it like this Answer The ?? Operator in PHP is the Null Coalescing Operator: Since in this case expr1 is false but is set, this expression returns Boolean false. Compare: Echo does not output when passed Boolean false.
composer require phpoffice/phpspreadsheet don’t work
initially, I needed a library that will help me upload data to Excel, found this library and then there was a problem i try to install composer require phpoffice/phpspreadsheet but i have problem I don’t understand where the error comes from, because there is a dependency “ext-spltype”: “*&#…
Delete MYSQL DB Entry via PHP / HTML Button
Hey. Iam learning PHP and MYSQL atm. So i wrote already code which will display everything from my database nicely into HTML. I create also a button which says Delete. Now i want to write a Code which actually Deletes the specific entry (all have an ID ) but iam kinda lost. i know the command is: $sql = ̶…
PHP how to add data to spaces
I need to take data from a variable called $destination and add spaces between the info So example: Would return: 123 Main St But I need it to return 123%20Main%20St So I need a script that will take the data from $destination and add %20 in the spaces. Answer Use urlencode() to produce a string with percent …
WordPress PHP get_results query from MySQL DB not working
I’m using the following PHP code to attempt to fetch values from the DB of all entries with ‘ID’ equal to 5055. It doesn’t return any result, and I’m not sure what’s wrong… Answer I presume this is a local webpage you’re working on. If so, here’s a couple …
Avoid Laravel redirect after validation
I’m making a simple validation on my Laravel controller: My problem is that this validation redirects me to the home if fails, and i’m making the request via AJAX, i know that Laravel detects when a request is via Ajax, but it only works if is a normal request (the typical request in which i send …