Announcements Last Post
Announcement : Programming Students at UNISA School of Computing 06/19/2019 02:01PM
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
PHP - Online tutorials
August 12, 2013 12:26PM
Hi all

found this site that is quite helpful to learning most programming languages, i used it for JavaScript and jQuery. I checked out the php tutorial and its helps to get you familiar with php.
http://www.codecademy.com/

And It is free to register.

Regards
Munei
Re: PHP - Online tutorials
August 21, 2013 10:32AM
I agree, helpful indeed
Re: PHP - Online tutorials
August 21, 2013 01:14PM
Many thanks, it is really helpful
avatar Re: PHP - Online tutorials
August 23, 2013 01:27PM
Another helpful site is this one. Nice site of you want to put some pretty into any web project.

CoDrops
Re: PHP - Online tutorials
October 02, 2013 09:26PM
Found a nice little tutorial to help understand how exactly preg_match() works.
Very useful when doing your validation for the forms thumbs up

PHPro Tut about preg_match
Re: PHP - Online tutorials
October 06, 2013 11:07AM
Thank you! Am planning on using Preg_match for my student registration form validation. This tutorial will be very helpful indeed!
avatar Re: PHP - Online tutorials
October 06, 2013 11:29AM
There is a much easier way of validation in PHP, without having to use regular expressions.

Look at filter_var()

http://php.net/manual/en/filter.examples.validation.php

http://php.net/manual/en/filter.filters.validate.php

http://www.w3schools.com/php/php_ref_filter.asp
Re: PHP - Online tutorials
October 07, 2013 12:58AM
Thanks bigron11! I was using the "FILTER_VALIDATE_EMAIL" already to check the emails which I find very handy.

Is it possible to use the filter_var() to just check for specific characters inside a variable? I had a look at the php.net and w3schools but can't see an example of that.
How would you use it to check, for example, if a variable contains only letters a-z and ' (single apostrophe) and spaces?

Thanks!
avatar Re: PHP - Online tutorials
October 07, 2013 08:03AM
You can use filter_var() to do that. It has a FILTER_VALIDATE_REGEX option.

Look here -

http://www.w3schools.com/php/filter_validate_regexp.asp


There is also an interesting discussion here -

http://stackoverflow.com/questions/10993451/filter-var-using-filter-validate-regexp
avatar Re: PHP - Online tutorials
October 07, 2013 11:36AM
The filter_var() works great. A function that I make use of a lot to clean user input is this one:

Language: PHP
function txtValidate($Validated){ filter_var($Validated,FILTER_SANITIZE_SPECIAL_CHARS); filter_var($Validated,FILTER_SANITIZE_MAGIC_QUOTES); filter_var($Validated,FILTER_VALIDATE_EMAIL); filter_var($Validated,FILTER_SANITIZE_EMAIL); $Validated = mysql_real_escape_string($Validated); $Validated = ucwords($Validated); return $Validated; }

___________________________________________________________________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning...
Sorry, only registered users may post in this forum.

Click here to login