wicksworks Posted September 30, 2013 Share Posted September 30, 2013 Disclaimer: This is my first attempt at doing anything with php, which might be overkill for what's required. Many of the pages of our website have one or more products with multiple selections (drop-down lists). Quite a few orders come in without a selection for one of the critical choices, which necessitates contacting the customer and waiting for a reply. A script which validates required fields could make things run much more smoothly for everyone. I've downloaded such a script and attempted to validate just one list (outside color) but have been unable to get the validation to work. Any guidance will be much appreciated. The files in question are attached for convenience. formvalidator.php 111-php-test.html Quote Link to comment Share on other sites More sharing options...
wicksworks Posted September 30, 2013 Author Share Posted September 30, 2013 Am I asking too much? My intention is not to take advantage of anyone's expertise but to gain enough understanding to continue experimenting with the script. The call to the php script is before the form that asks for all the selections and eventually sends the product to the shopping cart. Toward the beginning of the script is this code: //Setup Validations $validator = new FormValidator(); $validator->addValidation("outside-color","req","Please select outside color"); At the point where the customer is asked to make a selection for outside color is this: <select size="1" name="product1[outside-color]"> <option value="dontselect=select outside color">select outside color:</option> <option value="outside color-White">White</option> <option value="outside color-Ivory">Ivory</option> </select> The product is sent to the cart without validating. Where have I gone astray? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 30, 2013 Share Posted September 30, 2013 http://www.html-form-guide.com/php-form/php-form-validation.html should read how to use the class first. maybe you would get more of an idea how it works. Quote Link to comment Share on other sites More sharing options...
cyber_alchemist Posted October 1, 2013 Share Posted October 1, 2013 a bit off topic , but shouldn't one should first validate the form thorough javascript or using something like jquery first ??? Giving useless load to the server isn't required , I was in html , css, and javascript designing before and now moving to php too. In most of the cases there should be validation on both in server as well as client side. Except for captcha systems .. that is if you are making your own use php . Quote Link to comment Share on other sites More sharing options...
wicksworks Posted October 5, 2013 Author Share Posted October 5, 2013 http://www.html-form-guide.com/php-form/php-form-validation.html should read how to use the class first. maybe you would get more of an idea how it works. I have read the documentation and clearly still do not understand it. Hence, back to the top of the "help" loop. :-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.