Skip to content

Tag: php

Set reason for thrown bad request in Yii 2

I’m writing an API and I have to throw HTTP 400 bad request like below and it works fine meaning that it displays the default HTTP 400 page (I have no views defined because I’m building an API) What I would like to achieve is to give some reason for the bad request error thrown so that who is usin…

How to make a delete request with Laravel

I am not using resource controller. The route: The controller function: The call: The program returns a MethodNotAllowedHttpException. Thank you. Answer You may try this (Notice the hidden _method input): Check Form Method Spoofing. Update: In the latest versions of Laravel, it’s possible to use blade d…

Inserting data into MySQL from a dropdown

I’m trying to make a dropdown list that allows users to select a training program that matches their needs, so when they select it, the option will go into a table in the MySQL database. This is my HTML form: What I need is an SQL query that will go with it, so when they select ‘Example option 3&#…

Run PHP background program on HTML without slowing down a page load

I send a trigger email when someone opens a page with things like an IP address in the email body. I use this to run the PHP scrip from another page. This PHP script takes time to process and it slows down the loading of a page for a customer. in the trigger.php is (I have taken out some lines