Sorry, I cannot see the real benefit of this class.

Recommend this page to a friend!

      PHP Select Box Validation  >  All threads  >  Sorry, I cannot see the real benefit...  >  (Un) Subscribe thread alerts  
Subject:Sorry, I cannot see the real benefit...
Summary:Package rating comment
Messages:2
Author:Ákos Takács
Date:2019-03-19 23:09:46
 

Ákos Takács rated this package as follows:

Utility: Insufficient
Consistency: Not sure
Documentation: Sufficient
Examples: Good

  1. Sorry, I cannot see the real benefit...   Reply   Report abuse  
Picture of Ákos Takács Ákos Takács - 2019-03-19 23:09:46
Sorry, I cannot see the real benefit of this class. Why would anyone store a select input in a string and try to find the values in that string instead of declaring an array which contains the values and generating the string from the array? I can imagine a case when you want to write a plugin and the plugin can only use the rendered output but not the original data. I am not sure how often it could happen. Even in that case the "checkinput()" method does not handle apostrophes around the value. It does not work either if the "value" attribute is not the first attribute of the option. The HTML code must be lowercase (you can use strtolower or mb_strtolower before calling the method of course). "=" must follow "value" without any whitespace. The HTML does not have this restriction. I could continue but I think you understand what I am trying say :) It assumes an unlikely situation. Let's see the other method. The README mentions "The class can also extract the list of all available options and return an array with all the option values." but it does not return anything. It just write it to the screen. If you really write a plugin "toarray()" is is not useful at all.

  2. Re: Sorry, I cannot see the real benefit...   Reply   Report abuse  
Picture of peyman peyman - 2019-03-20 00:19:52 - In reply to message 1 from Ákos Takács
hi.a short story a client wants me to create a signup page that includes several select boxes for the country, states,job, position, company applications,referral, and stuff and each select box had at least 30 option that changed with two or three times depends on the user-selected value of job and position combined and then another select box appears . so none of the options were stored on the database . so I tried to validate them for each select box and I had to convert options from each select box to a PHP array and then check the user selected input with my array so they don't change them in browser inspect and inject something in DB or just send something random. at the time and scale, it was easier for me to create this class to check the values base on the select boxes HTML, it was faster, easier to edit and I was just being lazy because if you ever worked on the none English website like Arabic, Persian some of the editors struggles with selecting the text. like an atom, if I want to select a Persian text with the mouse it will not show me accurately where I selected, where is the end of the text etc, imagine if you want to validate the 100 option manually so I just write this class instead. what it does it check user entered value with options in select box as a whole and if it's present then return true, very simple class takes like 5 min for me to write and get the job done. the toarray method is for when you don't want to use the check value method with HTML(it export options as an array then dump the array as a text). you want to export options in the select box as an array, save it in PHP as a variable and just check the values there. and yes there is no use for this class if your select box is small or you can load it from the database. Have a nice day

 

For more information send a message to info at phpclasses dot org.