Jump to content

PHP Fields Logic & Math (input & Select fields)


studgate

Recommended Posts

Hey guys,

 

Thank you in advance... here is my situation, I have a form with three (3) fields in it, the 'student name' is unlimited textfield with an "add more" button to it and I have two select fields ('number of shirts' and 'trophies') that depend on the number of entries for 'student name'...

 

I want to create the select fields based on this math, for as many 'student name' entries:

 

1- i want to have the select form for 'number of shirts' to be 0 up to that number... so if there are 6 'student name' entries, the select options will be 0,1,3,4,5,6,7

2- I want to have the select form for 'trophies' to be 5 'student name' entries to 1 'trophies', for example if there are 6 'student name' entries, the select options will be 0,1... if there are 13 entries, options will be 0,1,2... So if there are less than 5 'student name' entries, the select field will not show (hidden)

 

of course if there are no 'student name' entries, these two fields won't show up (hidden)

 

let me know if that make sense and ANY help or directions will be GREATLY APPRECIATED.

 

Thanks guys!

 

Link to comment
Share on other sites

1 - what is an 'unlimited textfield'?

2  - what is a 'select field'?

 

You show examples of how you want some (input?) fields to be dependent on other fields, yet your 'rules' for those dependencies make no sense.  For ex, you say 'so if there are 6 'student name' entries, the select options will be 0,1,3,4,5,6,7'.  Why "1,3,4,5,6,7" and not "1,2,3,4,5,6"?

 

Perhaps you just need to re-read your post and try again?

Link to comment
Share on other sites

that clearly was a typo ginerjm, thanks for capturing it :happy-04: ... it supposed to be 0,1,2,3,4,5,6 as you mentioned! the reason for the zero is they can select none and we need to record it

 

It was also suppose to be unlimited input textfield (find demo here: http://jsfiddle.net/studgate/tqj8bxdh/), this is without the

other SELECT fields

 

thanks!

Edited by studgate
Link to comment
Share on other sites

are you kidding? read this and tell me which part you don't understand

 

Thank you in advance... here is my situation, I have a form with three (3) fields in it, the 'student name' is unlimited textfield with an "add more" button to it and I have two select fields ('number of shirts' and 'trophies') that depend on the number of entries for 'student name'...

Link to comment
Share on other sites

You're being rude to a guy who is trying in the worst way to understand your vague technical details ( at least they are supposed to be technical details) and wondering what you are talking about?

 

 

What the H... is "unlimited textfields"?  Is that some new html tag that I don't know about?

 

What is a "select field"?  Is that a field for input aka - 'input'  or is that an html "select" field?

 

Your very loose usage of programming terms is making your English request for help hard to fathom.

 

Is that clear to you?

Edited by ginerjm
Link to comment
Share on other sites

I think I understand the select fields to be just that - HTML select fields. However, I too am perplexed by what is meant by an "unlimited text field with an 'add more' option". Never heard of such a thing. And, if the field is "unlimited" what is the purpose of an "add more" option?

 

In any event, it sounds like you want a JavaScript solution, not PHP. If so, this is in the wrong forum.

Edited by Psycho
Link to comment
Share on other sites

Thanks Psycho, I always thought this board to be advanced so I was explaining it as such but will explain more details if I have other questions again...

 

ginerjm, thanks for trying to get it but everything I said made sense for advanced developers and being a developer for 9 years I will figure it, I always do. i did post an example for you above so you can understand the unlimited textfield concept, you can add a submit button to process the entries and validation

 

I started coding this using JavaScript instead as it made more sense and will share the solution here later today if anybody is interested.

Link to comment
Share on other sites

I'm glad you feel that your 9 years of development experience makes you confident in finding your own solution.  I usually feel that way with my 30+ years of the same, but only when I understand the problem.  Perhaps you will develop some better abilities using English to explain yourself in the future.

 

Good luck!

Link to comment
Share on other sites

If "student name" is a text field (I assume you mean textarea), then how do you plan on determining the number of students entered into it by the user? It depends on what the user enters...like one name per line (hitting enter after each name), names separated by spaces, names separated by commas.  How do you plan on determining how the user entered the student names into that field if it's entirely up to the user?

Edited by CroNiX
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.