Page 1 of 1

<form> tags keep disappearing

Posted: Sat Jan 16, 2010 8:15 am
by slaterino
Hi,
I have a small search button on a website which does a really basic search on the MySQL database. However, the form tags keep disappearing. This seems really strange. The search button should look like this:

Code: Select all

<form name="form" action="catalogue.php" method="get">
<input type="text" name="qsearch" size="15"/>
<br />
<input type="submit" name="Submit" value="Search" width="6" size="6" height="6"/>
</form>
However, sometimes when the page loads the <form> tags are not generated, and so it ends up looking like this:

Code: Select all

<input type="text" name="qsearch" size="15"/>
<br />
<input type="submit" name="Submit" value="Search" width="6" size="6" height="6"/>
I have never known something like this to happen before so don't even know where to start in finding the problem. Has anyone had any experience of this before or know how to fix this problem???

Thanks
Russ

Re: <form> tags keep disappearing

Posted: Sat Jan 16, 2010 2:37 pm
by califdon
Are you saying that the HTML you showed is generated by PHP? If so, it's that code that we need to see. If it is coming from a plain HTML file served by a web server, I don't see any way that it could omit a line.

Re: <form> tags keep disappearing

Posted: Sat Jan 16, 2010 10:17 pm
by slaterino
The form is not generated by php. It is written in HTML, exactly as I have written it. There are some functions on the page that are written in PHP but they have absolutely nothing to do with the FORM. This is why this problem is so strange!

To see this in action. The code is on two different pages.

http://www.showglads.com
http://www.bramcotebulbs.com

The really strange thing is how they sometimes seem to work perfectly and other times not at all. For instance, the first time the page is visited and a search is done using the box on the right, quite often the script will work and the search will be done. However, if you try and do a search again on the next page, pretty much everytime I have tried it it will not work, and if you look at that script you will see that the <form> tags have disappeared. Plus, the Bramcote Bulbs site seems to work the majority of the time, with just occasionally this happening. I have looked at both scripts in minute detail and they are identical so I just can't work out how this is happening. Any help would be so much appreciated!!!

Re: <form> tags keep disappearing

Posted: Sun Jan 17, 2010 10:25 am
by califdon
I don't know what to tell you. I viewed both your URLs and used the search 4 or 5 times each, and everything was normal. The <form> tag was always there. I can only say that if there's some HTML (not generated by PHP) in a file, the web server will send it to the browser.

Re: <form> tags keep disappearing

Posted: Mon Jan 18, 2010 11:08 am
by kaszu
Problem is that on this page http://www.showglads.com/catalogue.php you have several opened <FORM> tags (for each item I guess), which are not closed (that's invalid html ofcourse) and browsers tries to fix them causing search form <FORM> tag to be removed, if you look at source (which comes from server, not firebug) form tag is there.

http://validator.w3.org/

Re: <form> tags keep disappearing

Posted: Mon Jan 18, 2010 7:55 pm
by slaterino
Hey,
Thanks for the help man, have now got rid of the other <form> tags completely and works perfectly. I think that <form> tag was a remnant of some previous work I had been doing.

Thanks!