Here In my form $num_questions contains a value of no.of questions user have entered through form , Basically the timer should be set for the value entered by user in no.of questions field but instead its is directly come to 0:00 just after clicking submit the form and redirect to form , I cant understannd how to fix this .
How can I fix it?
@Paul_Wilkinsits hey I checked that and its just taking the input value which is entered by user through form field named no.of questions which is stored in a variable name $num_question i.e if I entered no.of questions = 6 then its just showing “Duration : 6” but not setting timer for 6 minutes, How can I check it? I am confused a bit
@Paul_Wilkinsits yes, but then I edited the line
var countdownTimer = setInterval(secondPassed(), 1000); and made it like this
var countdownTimer = setInterval(secondPassed, 1000); but its still setting to 0:00 directly and redirecting to my form
How can I correct it then?
Okk Thanks a lot . Its working now actually I removed the line of var seconds and put it in my output form code and then its working properly, but thanks for yor help, I also learnt some new thing from this conversation.
@Paul_Wilkinsits hey sorry too bother you again , but the timer is again showing the same failure but ths time its working for $num_questions but instead when I assign var secons to anothe variable named $duration (duration is my other form field like questions), and I just chnged the nme there and its showing the failure again , and I checked the pgp source code also its just as same as it was for the $num_question.
When you assign a number to a form field, the form converts it to a string.
Without seeing what you’ve been doing, it’s a fair bet that when you retrieve duration from the form, that it’s a string and should be converted to a number.