Skip to main content
October 20, 2006
Question

Does anyone know how to apply a class to a form?

  • October 20, 2006
  • 4 replies
  • 406 views
Hi I have found this class with functions to validate forms and was wondering how to apply it to the Insert Record etc.
Thanks
This topic has been closed for replies.

4 replies

October 21, 2006
Yes, thanks the book is on order hasn't arrived yet.
I have shown below what is used for this class:
This is what is used on the form page in the demo of this class.
Will dreamweaver allow me to include this class with the insert record etc.
I have noted in Google searches that people have had trouble with includes using dreamweaver. I am using dreamweaver 2004 not dreamweaver 8.
I tried to use the examples for form validation using php from David Powers and it worked brilliantly the first time and when I turned the computer on the next day it wouldn't. It now will not validate anything on that page no matter what I change. Even if I use the Check Username exists or anything I used previously.
I must have a bug or something.
So I am a little terrified of changing my files as I spent many weeks on this. So I thought my alternative was to use this class and include it within.

include("validation_class.php");
if (isset($_POST['submit'])) {
$example = new Validate_fields;
$example->check_4html = true;
$example->add_text_field("Simple_text", $_POST['string'], "text", "y");
$example->add_num_field("Number", $_POST['number'], "number", "n", 0, 5);
$example->add_num_field("Number_with_decimals", $_POST['decimal'], "decimal", "n", 2);
$example->add_date_field("Euro_date", $_POST['date'], "date", "eu", "n");
$example->add_check_box("Check_box", "check", "checkbox");
$example->add_link_field("Email_address", $_POST['email'], "email");
$example->add_link_field("internet_link", $_POST['url'], "url", "n");
if ($example->validation()) {
$error = "All form fields are valid!"; // replace this text if you like...
} else {
$error = $example->create_msg();
}
}
?>



Thanks
Inspiring
October 20, 2006
On Fri, 20 Oct 2006 01:23:35 +0000 (UTC), "jjjhbj111"
<webforumsuser@macromedia.com> wrote:

>Hi I have found this class with functions to validate forms and was wondering how to apply it to the Insert Record etc.
>Thanks

Depending on the class you have found it sounds like you might have
trouble.

Currently there is a special offer on WebAssist's Validation Toolkit.
I use it and like it and you might benefit from the help files and
tutorials. Details here:

http://www.webassist.com/professional/products/specials.asp
--
Steve
steve at flyingtigerwebdesign dot com
October 20, 2006
Hi thanks - I am not very fluent in coding, very slowly learning.
I still find that I can code some php and it works but as soon as I place it in amongst Dreamweaver code it doesn't work.
So this is why I thought maybe applying a class that validates all alternatives within a form may help.
Thanks again
Deaf_Web_Designer
Inspiring
October 20, 2006
If I may to say something, since you are working with PHP for the first time. Do you intends to work and develop data-driven websites. If that is the case, perhaps that you might be interested to purchase this book called, "PHP for Dreamweaver," wrote by David Powers. It is an excellent book. When I say "excellent," I meant it. *hands down*

quote:

Originally posted by: jjjhbj111
Hi thanks - I am not very fluent in coding, very slowly learning.
I still find that I can code some php and it works but as soon as I place it in amongst Dreamweaver code it doesn't work.
So this is why I thought maybe applying a class that validates all alternatives within a form may help.
Thanks again
Deaf_Web_Designer
Inspiring
October 20, 2006
How fluent are you with PHP coding?