Form validation with functions

Posted on 16th Feb 2014 07:03 pm by admin

Hi there

I am trying to make a very simple form validation function. I currently have the following

function formValidate($field, $msg) {

if (empty($_POST['$field'])) {
$errors[] = $msg;
} else {
$field = mysqli_real_escape_string($dbc, trim($_POST['$field']));

}// end of function

formValidate('form', 'You forgot to enter the form');

When I run the script and enter nothing into the $_POST['form'] field it still executes an empty record into the database.

What am I doing wrong?

No comments posted yet

Your Answer:

Login to answer
169 Like 33 Dislike
Previous forums Next forums
Other forums

Contents of variable not echoing
Hey guys, hopefully this is an easy one...

In this line, the variables are not echoing out. T

AAA Replica Ferrari :
[b][url=]schweiziske replika ure AAA +[/url][/b] [b][url=http://www.wat

Upload simple problem
Really confused!! I run once and it worked, but when i tried didn't work

Which par

Help uploading .JPG
I have a problem with upload images when the ending is .JPG capitalized.. I really don't know what c

Baratos Moncler , Moncler Jaquetas Casacos
jaquetas moncler outerwear
jaquetas moncler outerwear

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Google+ Indyaspeak @ Pinterest RSS