Function not Functioning

They have: 238 posts

Joined: May 2002

I have a script here , and when you submit it without any data a function which chooses the right error message wont show up? It just comes up with errormessage();

Here is the source, It worked at first but I dont know what has happened..?

Source

He has: 1,016 posts

Joined: May 2002

Two mistakes...

1. You can't call a function from inside quotes.

echo "There are a total $errors errormessage(); ";

2. Since functions have their own variables, you need to define $errors as global. Add the following line before the first "if" statement inside your function.

global $errors;

They have: 238 posts

Joined: May 2002

Thanks zollet.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.