Page 1 of 1
Problem with browsers on my PHP code
Posted: Fri Jul 15, 2011 5:27 pm
by Infinity
Hi,
I have a little bit problem. I'm doing a little game on PHP and I browsers don't help with. In one moment, on the game, there are some questions and you should type an answer (input type text), I pass the answer by html POST then I compare, to look if it's the right answer. But I have a problem, browser remember all that you have written on the "input type text" so... in that way, if someone is right one time, it will be always right...
Anyone one knows anything that I could do to improve this?
Re: Problem with browsers on my PHP code
Posted: Fri Jul 15, 2011 5:40 pm
by Jackolantern
Can you post the code?
Re: Problem with browsers on my PHP code
Posted: Fri Jul 15, 2011 10:32 pm
by Xaleph
Add this to your input field: disabled="disabled"
It`s the only part on Microsoft they contributed to the WWW which was worth the effort and not making it on the final drafts for a long time. Although most browsers did adopt it from the beginning..
Re: Problem with browsers on my PHP code
Posted: Fri Jul 15, 2011 10:50 pm
by Jackolantern
Xaleph wrote:It`s the only part on Microsoft they contributed to the WWW which was worth the effort
Errmm...httpXmlRequest object AKA the entire foundation of AJAX?

Re: Problem with browsers on my PHP code
Posted: Fri Jul 15, 2011 11:37 pm
by Xaleph
Correct, however, that one was adopted by the W3 standards comittee from the start. The first draft of JS, I believe, already provided such an interface. It just took a while for others to find good use for it. And, if i`m not mistaken, it was built in their liveScript, not javascript (ecma1.0)
Re: Problem with browsers on my PHP code
Posted: Sat Jul 16, 2011 8:44 am
by Infinity
With disabled="disabled" the text label became disabled and I can't type in there nothing.
The code of this it's only this following lines:
Code: Select all
<form method="POST" action="verification.php">
Answer: <input type="text" name="answer" size="50">
<br>
Any idea?
Re: Problem with browsers on my PHP code
Posted: Sat Jul 16, 2011 3:41 pm
by Xaleph
Hmm yeah, my bad, sorry. I actually had to google for the solution but here it is:
autocomplete="off"
This is the attribute I was talking about, and it would seem it still is not adopted by W3. So, if you want W3 valid code ( no real use for "valid" code, if you know what you are doing) but you can randomize fieldnames. Something like name="email_<?=randomNumber();?>" and use the substring or explode on the _. Anyway, autocomplete="off" should work just fine, the only downside is it will trigger an error on the validator.
Re: Problem with browsers on my PHP code
Posted: Sun Jul 17, 2011 12:52 am
by Callan S.
I'm not sure if I understand the problem, but if it's that previous values show up, you can put in
to show a blank value. Or whatever value you want.
Re: Problem with browsers on my PHP code
Posted: Sun Jul 17, 2011 9:05 am
by Infinity
Xaleph wrote:autocomplete="off"
That have worked, thanks for all for your help. But now I have one last question, now I have a question that needs to be solved, with the same answer, I have two php files, one called question and one called verification, I pass the answer with a POST method. So now, If I want to make more different answers, how can I do, to pass an id of the question and the values written by the user if I have used the POST method? I mean, I can pass the answer, because it is on "input type= text", but..., How can I pass an ID for the question too?
P.D: Sorry for my bad English >__<'''
Re: Problem with browsers on my PHP code
Posted: Mon Jul 18, 2011 10:55 pm
by Infinity
Anyone can help me?