[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[K12OSN] PHP and variables



I know how to get data in from a form, but I need to know how to get a string converted from a letter variable to a number variable.

Example:

Say there are two choices and I am using radio buttons to select which choice the viewer wants.

It stores the first choice as "a" and the second choice as "b". This I know how to do.

So I would like to convert the a to 1 and the b to 1 and store them each in another variable of their own. I know how to get them into another variable, also.

Now, I want to add up the number of "a"s and the number of "b"s .

All I really need to know is how to convert a letter to a number in PHP.

if choice=a then choice1num=1   <<<<this part
if choice=b then choice2num=1   <<<<this part
echo choice1num
echo choice2num

Thanks!

Doug Simpson
Technology Specialist
De Queen Public Schools
De Queen, AR
simpsond leopards k12 ar us
"A Dollar Saved is a Dollar Earned"




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]