A question about PHP!

  • 1
  • Question
  • Updated 9 years ago
I need to ask questions and have certain answers determine a particular answer.

It will be "what style is right for me" in regards to martial arts.

I've come to the conclusion the best way is a combination of the IF Statement and a Math Function. But I just don't know how to do it!

How I think it needs to be...

question name="taekwondo"
question name="taekwondo"
question name="kenpo"
question name="aikido"
question name="kenpo"
question name="taekwondo"
question name="judo"
question name="kung fu"

...as an example!

The name will refer to what type of question it is, "do you like to kick" - taekwondo, etc.

The values will be Yes (+1), Not Sure (0), No (-1)

if yes add 1 to math function, if not sure add 0 to math function, if no subtract 1 to math function.

The math functions below will be based on the question name. all taekwondo questions will be added together, all kenpo questions etc.

Then there will be another if statement.

if taekwondo value is highest, echo "Your preferred style is Tae Kwon Do", etc.

if two or more styles are highest, default: the first highest value - this might call for a StrPos to echo the first!

I know PHP experts are using Yola and your help is greatly appreciated! :)
Photo of Donald

Donald

  • 2991 Posts
  • 37 Reply Likes
  • http://youcanneverbetoosmart.com

Posted 9 years ago

  • 1
Photo of Donald

Donald

  • 2991 Posts
  • 37 Reply Likes
Here's what I have so far...

http://pastesite.com/15874

How do I add the values in each question with like questions?

question 1, 14, 27
question 2, 15, 28

taekwondo questions with taekwondo questions and kenpo questions with kenpo questions, etc.

I don't want the values shown to the user, instead, I want the highest value selected and echo a statement based on the outcome, echo "Your Preferred style is Aikido", etc.

I also need a submit button to properly process the form! :)

etc.
Photo of lambofgod

lambofgod

  • 875 Posts
  • 35 Reply Likes
Hey Donald,

I got your email and gave you a code, but your email service denied me saying I was using it "maliciously" and the won't let me send you any more emails. Kind of funny if you ask me.
Photo of Donald

Donald

  • 2991 Posts
  • 37 Reply Likes
lol, really? I'll have to look into that. Feel free to post here in the meantime! I also have yahoo, which I don't usually check, but if you let me know you emailed me at yahoo I'll go check it.

donald.faulknor@yahoo.com

but you can message me here if you would like!