Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matt Stauffer:
Form array validation in Laravel 5.2
Dec 17, 2015 @ 17:23:35

Matt Stauffer has kicked off a new series on his blog about some of the new features in Laravel 5.2 and how to use them effectively. In this first part of the series he looks at form array validation and using it on more complex form submissions.

Form array validation simplifies the process of validating the somewhat abnormal shape of data HTML forms pass in when the array syntax is used. If you're not familiar with it, a common use case is when you allow a user to add multiple instances of the same type on one form.

[...] But how do we validate this? Prior to 5.2, it's a bunch of manual work. Now, Laravel understands this nesting structure and can validate against it uniquely.

He compares the new validation handling with a standard validator (for a single text string) and shows how a "dot" (period) notation can be used to define the more complex rules. You can even use asterisks for wildcard making at any level. Definitely a nice addition to the validation handling in the framework.

tagged: form validation array laravel5.2 version wildcard complex tutorial series part1

Link: https://mattstauffer.co/blog/form-array-validation-in-laravel-5-2

Paul Gregg's Blog:
PHP algorithms: Determining if an IP is within a specific range.
Apr 28, 2009 @ 14:25:39

Paul Gregg has shared a method he's come up with to determine if a given IP is within a selected range.

Unfortunately although people usually understand that an IP address is simply an unsigned 32 bit integer, and is easily determined, usually with $_SERVER['REMOTE_ADDR'], where the real challenge is - is in specifying the range within which they wish to check that IP address. IP ranges are usually specified in three common ways (in increasing complexity): wildcard, start-end range, classless inter-domain routing.

He looks at each method and includes descriptions and code examples as well as a link to the source code and a live demo of it in action.

tagged: algorithms ip address specific range three method wildcard cidr startend

Link:

Echolibre Blog:
Customising Zend Framework Routing
Mar 13, 2009 @ 15:23:04

On the echolibre blog J.D. has made a new post looking at Zend Framework routing and how you can customize it to get the user where they need to go.

I wanted to write a post that shows a few different ways to customise Zend Frameworks routing when you’re using their MVC implementation. Most of this is covered in the documentation, but it can be a little difficult to dig out.

He starts with the normal routing setup (the standard /module/controller/action and /controller/action setups) and moves on to the "magic" - a way to have a standard "framework URL" without having to include an action. He sets up a route with a wildcard to catch anything for that controller and passes it off to a custom router that goes through the request values and returns the values as though they were formatted normally in the URL.

tagged: zendframework routing custom wildcard match parameter url

Link:

WebReference.com:
How to Create a Search Feature with PHP and MySQL
Aug 07, 2008 @ 12:53:10

On WebReference.com today Ryan Butler has written up a tutorial of a simple search feature that can be integrated into any site (with their content in a MySQL database).

In this article, you'll learn how to create a searchable form feature that will query a database table and display current staff member information. During the analysis you'll learn how to do the following: create a database table that will hold current staff listings, create a search form and use PHP, in coordination with Structured Query Language (SQL) to capture information entered by the visitor and append the information to display the results we want to show.

They give you the files for the project and work through each, showing how to make the database, put information in and connect to the database to run the query. He opts for the LIKE functionality in the WHERE clause to find the term as a wildcard in the FirstName field. It's not the most efficient, but it can be useful.

tagged: mysql search engine like wildcard tutorial

Link:

The bla.st Blog:
Process your URLs in PHP with Apache mod_rewrite and wildcard DNS
Jan 02, 2007 @ 14:10:00

There's a quick post on the bla.st blog about a handy method to create "pretty URLs" for your website without changing your code (much). With this example, it's all about Apache and mod_rewrite.

For our bla.st project, we decided to put all URLs through a single PHP script, and process them there. The advantage is then we can do what ever we want with the URLs.

They provide the settings and directives that you'll need to drop into Apache and what they're doing so you can customize them to your site. There's even a brief PHP example at the end showing how to get the information from the URL and into a usable form.

tagged: process url apache modrewrite module wildcard dns process url apache modrewrite module wildcard dns

Link:

The bla.st Blog:
Process your URLs in PHP with Apache mod_rewrite and wildcard DNS
Jan 02, 2007 @ 14:10:00

There's a quick post on the bla.st blog about a handy method to create "pretty URLs" for your website without changing your code (much). With this example, it's all about Apache and mod_rewrite.

For our bla.st project, we decided to put all URLs through a single PHP script, and process them there. The advantage is then we can do what ever we want with the URLs.

They provide the settings and directives that you'll need to drop into Apache and what they're doing so you can customize them to your site. There's even a brief PHP example at the end showing how to get the information from the URL and into a usable form.

tagged: process url apache modrewrite module wildcard dns process url apache modrewrite module wildcard dns

Link:


Trending Topics: