How to use if empty function in dynamic text fields?
-
here's my code for static text field: [code]function displayerror($fieldname, $errormsg) { global $errorcount; echo "Error for $fieldname: $errormsg "; $errorcount++; } function validateinput($data, $fieldname) { global $errorcount; $totalquiz=($_POST['totalquiz']); if(empty($data)) { displayerror($fieldname, "This field is required" . "<br>"); $errorcount=1; $retval=""; } else { $retval = trim($data); $retval = stripslashes($retval); if(!is_numeric($totalquiz)) { displayerror($fieldname, "This field should be numeric" . "<br>"); $errorcount=1; } } return($retval); } $totalquiz=validateinput($_POST['total… "Total # of quizzes"); if($errorcount>0) echo "please use the back button to re-enter the data" . "<br>"; else { echo $totalquiz; [/code] my problem is how can i apply this if my text fields are dynamic? let's say in my index.html there's a button that ask how many quiz are there. so if i put 2, 2 text fields are generate w/ name property ="quiz" how can i apply this array looping in the above codes? :|
-
Answer:
May the following discussion thread of use to you http://www.webmasterworld.com/forum88/3490.htm
bernard at Yahoo! Answers Visit the source
Related Q & A:
- How to create text fields dynamically?Best solution by Stack Overflow
- How to use hadoop for text file?Best solution by Stack Overflow
- How to use BitmapFont.TextBounds to center a line of the text on the screen?Best solution by Stack Overflow
- How to use empty titles for buttons on the ApplicationBar?Best solution by Stack Overflow
- How do you use the Contains Function in Visual Basic?Best solution by go4expert.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.