Hi riya
From what I can see (anyone else on this site please correct me if I'm wrong), you are having this problem because you are still sending data to the browser berfore your redirect. Only in this case the data you are sending is javascript (js still needs to be sent to the browser before it can be run).
You could try including your validation js AFTER you include getresults.inc.
This may do the trick but you need to adress a few other things that are just (if not more) important...
You should NEVER have your primary validation done in js. This is a HUGE security issue because it is executed client side, not server side and therefore cannot be trusted. ALL validation should be done server side.
It is fine to have some validation done in js but only for cosmetic reasons (being able to display a nice popup). If you do this it should still ALWAYS be followed up by server side validation.
As well as being server side, your validation should be much more stringent. With the sort of validation you have carried out, even if the equivalent was done sever side, it would be a simple matter to carry out an SQL injection attack and there goes your DB... an attacker would be able to retrieve your data or even erase the contents of your DB.
As you can imagine, this is NOT A GOOD THING™.
The basics of protecting against SQL injection attacks require verifying data or stripping or modifying all unsafe characters from any user input that is used in an SQL operation.
A quick trip to google provided this link which seems to be a good explanation of SQL injection attacks and methods for preventing them. If you plan on doing any serious PHP you MUST be aware of these issues.
I hope this helps.
omin




Reply With Quote