<form> tags keep disappearing

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
slaterino
Forum Commoner
Posts: 46
Joined: Fri Jul 11, 2008 10:50 am

<form> tags keep disappearing

Post 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
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: <form> tags keep disappearing

Post 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.
slaterino
Forum Commoner
Posts: 46
Joined: Fri Jul 11, 2008 10:50 am

Re: <form> tags keep disappearing

Post 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!!!
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: <form> tags keep disappearing

Post 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.
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: <form> tags keep disappearing

Post 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/
slaterino
Forum Commoner
Posts: 46
Joined: Fri Jul 11, 2008 10:50 am

Re: <form> tags keep disappearing

Post 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!
Post Reply