% Ultra Newbie Question %

T

Tayna Taylor

Ok, here goes -- I don't know if this is too complex to figure out,
but let's give it a shot! :)

I have a SQL loop around a bunch of HTML code:

///*START SQL LOOP*

<html>
PHP, graphics, code & stuff
</html>

///*END SQL LOOP*


So, ok this runs and spits out however many result sets (sections) on
the screen. Fine so okay, it works -- but here is the clincher & what
I want to do --

Each HTML result set has two tabs... if someone clicks on a tab it
shows different data in the HTML result set -- so what I want to do
for elegance rather than having the screen refresh is to use some kind
of DHTML <div> technique to statelessly go between each screen in each
section when a user clicks back and forth on a tab.

So below is something I was thinking about how in theory it could
work, but I don't know how I would implement it...


///*START SQL LOOP*


//(I want this displayed initially)

<div ID="StateOne">
<html>
PHP, SQL, graphics, other code & stuff
</html>
</div>

//(I want this displayed when a tab two <a href> button is clicked)

<div ID="StateTwo">
<html>
PHP, SQL, graphics, other code & stuff
</html>
</div>

///*END SQL LOOP*


(FYI - above you can assume that the database has already been queried
before this, so the entire dataset needed is all ready to plug in
wherever its needed)


I've seen various techniques on how you can change stuff on the screen
using <div> tags and javascript - but the SQL loop around this,
compounded by the fact that there may be more than one of these at any
given time seems to make this a very difficult boggle for me.


If anyone can solve this I will be so so so happy, because my life as
a developer seems to now depend on it!!!!

Sincerely,

Tayna Taylor
 
F

Fabian

Tayna Taylor hu kiteb:

//(I want this displayed initially)

<div ID="StateOne">
<html>
PHP, SQL, graphics, other code & stuff
</html>
</div>


eek! Stop right there. HTML tags cannot appear inside anything
whatsoever. they are the top level.

In basic terms, you want each DIV to have a unique ID, set all but one
to visibiloity:hidden at start, and have the tabs (outside all the divs)
set visibility tags appropriately.
 
V

VK

You did not tell this explicitly, but I presume that you are using some
"on-fly" page generation technique, must be ASP (No PHP or JSP, I think,
otherwise you would not be so humble in your request :)

The important question to answer is how much do you care of losers
(wanna-bes, future destroyers of the M$ Empire of the Evil, you name
it).
More of them you want to include in your solution, more complicated the
solution will be.

Let's say you care only of the current winner (IE) and Netscape (for the
traditional respect to its former glory). That would cover about 97% of
your customers. If it sounds OK to you then:

1. Customer's calling your page with yourpage.asp?blah-blah-blah

2. Your are generating two (three, four, five) data sets for this
request and put them in <div></div> within the same <html> page.

3. For each div you are making a tab top to switch from one tab (div) to
another.
The basic technique is
document.divID.style.visibility = "visible"
document.divID.style.visibility = "hidden"
But to save your time, just go to www.dynamicdrive.com, they have a
bunch of interfaces of this kind.

If you make another dare step to work with IE users only (which will
drop your coverage to about 91%), I would suggest to look at Microsoft
Data Island technique. Does all the same, but with tons of time saved.
 
T

Tayna Taylor

eek! Stop right there. HTML tags cannot appear inside anything
whatsoever. they are the top level.

Double EEP! Sorry! All of those <html> tags are supposed to be <table> tags!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top