[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.7

How to implement PHP validation class.

Asked by MHenry in PHP Scripting Language, PHP and Databases, PHP for Windows

Tags: php class form validation

I'm new to classes in php and am trying to figure out how to use this class:

http://www.phpclasses.org/browse/package/3737.html

If someone could help me get started, I'd appreciate it.

What I'm trying to do is use the required field validator. An example is here:
if (! valid::hasValue(valid::getFormValue("FirstName"))) {
    $problem .= "First name is required<br />";
}

I've done the include, validation.class.php.
And I THINK that where the form says "FirstName" is where I should put the the name of the form field.

Here's a sample of my code:
<?php include("validation.class.php");
foreach ($_POST["badge"] as $badge){ // each badge is one array itself
if (! valid::hasValue(valid::getFormValue("firstName"))) {
    $problem .= "First name is required<br />";
}
$sql = 'INSERT INTO attendeenames (customerID_cart,firstName,lastName,badgeName,email,membType) ';
$sql .= 'VALUES ("'.mysql_real_escape_string ($_POST["customerID_cart"]).'","'.mysql_real_escape_string($badge["firstName"]).'","'.mysql_real_escape_string($badge["lastName"]).'","'.mysql_real_escape_string($badge["badgeName"]).'","'.mysql_real_escape_string($badge["email"]).'","'.mysql_real_escape_string($_POST["membType"]).'");';
mysql_query($sql);
}

Nothing I try in the getFormValue("firstName"))) appears to be working. I've even tried looking at the source of the page with the form and using the ID and the name but neither work.

Here's the source from the page with the form after it renders (the form is rendered so I pulled the source code):
<td><input type="text" name="badge[11][firstName]" size="10" id="firstName11"></td>


I'm wondering if there's somewhere in the class that I'm supposed to set some values for form name or something but I can't find anything.

Best,
MH


[+][-]07/25/09 04:33 PM, ID: 24943588Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/25/09 04:33 PM, ID: 24943590Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/25/09 05:02 PM, ID: 24943639Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/25/09 05:37 PM, ID: 24943667Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: PHP Scripting Language, PHP and Databases, PHP for Windows
Tags: php class form validation
Sign Up Now!
Solution Provided By: cxr
Participating Experts: 2
Solution Grade: A
 
[+][-]07/25/09 05:47 PM, ID: 24943682Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/25/09 06:20 PM, ID: 24943731Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/25/09 06:28 PM, ID: 24943741Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/25/09 06:59 PM, ID: 24943803Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/25/09 07:05 PM, ID: 24943815Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_EXPERT_20070906