From: Juan Rodriguez Monti on 27 Apr 2010 08:36 Hi guys, I have some issues with while. I have an HTML Form, that uses GET to process its contents. Then there's a PHP Script that receives the data, and evaluates the fields. So, in some instance of the code, I do something like : if (empty($a) AND empty($b)) { echo "something"; echo "something"; echo "something"; while ($row = sqlite_fetch_array($results,SQLITE_BOTH)) { And here I print some echo's to print an HTML's Table with the results of the while. echo "Something more"; echo "etc"; } } elseif (empty($c) AND empty($d)) { Here there is another elseif similar to the first one explained above. } I have four or five elseif's that analizes the fields of the HTML's Form and then the PHP's Code do things depending of the combinations of fields submited and so on. The problem is that if I want to add an echo saying "Come Back to Index" to index.html, I'm not able to show it after the while's iteration. The PHP code prints the table with its results taken from SQlite perfectly. Also it evaluates all the conditions flawessly. However, If I add a link to come back with the text "Go to Index" after the while and before the } close to the next elseif, PHP prints it in the wrong ubication. I got something like: TITLE *** Go to Index *** While results. This is the table containing all the results of the SQlite's Query. If I move the echo to other part of the block, I receive so many echo's as iterations the while do ( this is logical ). However I don't understand why the echo is printed above the while even when I put it after the while and out of the while's block. Thanks a lot!. Juan
From: Peter Lind on 27 Apr 2010 08:40 On 27 April 2010 14:36, Juan Rodriguez Monti <juan(a)rodriguezmonti.com.ar> wrote: > Hi guys, > I have some issues with while. > > I have an HTML Form, that uses GET to process its contents. Then > there's a PHP Script that receives the data, and evaluates the fields. > > So, in some instance of the code, I do something like : > > if (empty($a) AND empty($b)) { > > echo "something"; > echo "something"; > echo "something"; > > while ($row = sqlite_fetch_array($results,SQLITE_BOTH)) { > > And here I print some echo's to print an HTML's Table with the results > of the while. > echo "Something more"; > echo "etc"; > > Â Â Â Â Â Â } > } elseif (empty($c) AND empty($d)) { > > Here there is another elseif similar to the first one explained above. > > } > > I have four or five elseif's that analizes the fields of the HTML's > Form and then the PHP's Code do things depending of the combinations > of fields submited and so on. > > The problem is that if I want to add an echo saying "Come Back to > Index" to index.html, I'm not able to show it after the while's > iteration. > > The PHP code prints the table with its results taken from SQlite > perfectly. Also it evaluates all the conditions flawessly. However, If > I add a link to come back with the text "Go to Index" after the while > and before the } close to the next elseif, PHP prints it in the wrong > ubication. > > I got something like: > > TITLE > > *** Go to Index *** > > While results. This is the table containing all the results of the > SQlite's Query. > > If I move the echo to other part of the block, I receive so many > echo's as iterations the while do ( this is logical ). However I don't > understand why the echo is printed above the while even when I put it > after the while and out of the while's block. > Check your html for broken html table code. Regards Peter -- <hype> WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 </hype>
From: Juan Rodriguez Monti on 27 Apr 2010 09:25 2010/4/27 Peter Lind <peter.e.lind(a)gmail.com>: > On 27 April 2010 14:36, Juan Rodriguez Monti <juan(a)rodriguezmonti.com.ar> wrote: >> Hi guys, >> I have some issues with while. >> >> I have an HTML Form, that uses GET to process its contents. Then >> there's a PHP Script that receives the data, and evaluates the fields. >> >> So, in some instance of the code, I do something like : >> >> if (empty($a) AND empty($b)) { >> >> echo "something"; >> echo "something"; >> echo "something"; >> >> while ($row = sqlite_fetch_array($results,SQLITE_BOTH)) { >> >> And here I print some echo's to print an HTML's Table with the results >> of the while. >> echo "Something more"; >> echo "etc"; >> >> } >> } elseif (empty($c) AND empty($d)) { >> >> Here there is another elseif similar to the first one explained above. >> >> } >> >> I have four or five elseif's that analizes the fields of the HTML's >> Form and then the PHP's Code do things depending of the combinations >> of fields submited and so on. >> >> The problem is that if I want to add an echo saying "Come Back to >> Index" to index.html, I'm not able to show it after the while's >> iteration. >> >> The PHP code prints the table with its results taken from SQlite >> perfectly. Also it evaluates all the conditions flawessly. However, If >> I add a link to come back with the text "Go to Index" after the while >> and before the } close to the next elseif, PHP prints it in the wrong >> ubication. >> >> I got something like: >> >> TITLE >> >> *** Go to Index *** >> >> While results. This is the table containing all the results of the >> SQlite's Query. >> >> If I move the echo to other part of the block, I receive so many >> echo's as iterations the while do ( this is logical ). However I don't >> understand why the echo is printed above the while even when I put it >> after the while and out of the while's block. >> > > Check your html for broken html table code. > > Regards > Peter Hi Peter, That was the problem. Solved!. Thanks, Juan
|
Pages: 1 Prev: special character problem Next: finding out datasets in a certain distance of a zip code |