It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
Hey all, long time no post etc...

I'm working on client records database at the moment and trying to figure out a way to make the query results anything other than a fugly mess. I've hit upon an idea of dynamically building tables to display the data in the same way that I do on the record insertion page (meaning I can copy/paste the same code with a few tweaks) but given that hundreds of records may be onscreen at one time, that will be a massive data overload.

What I want is to create one line summaries of the client and make them clickable links to expand a hidden DIV tag. I came across this javascript example that does the exact thing I want but I don't want to use javascript for it (it'll be on a system not managed by me so I can't be certain that javascript will never be just turned off without considering my system).

Can anyone suggest a way to do this type of thing with pure PHP & HTML (ideally without on page buttons)?
No posts in this topic were marked as the solution yet. If you can help, add your reply
PHP and HTML are static, if you need interactivity, you either need on page buttons (next / previous; when clicked, run a new query with a LIMIT instruction to only show one item using the current offset) or using JavaScript.
How about making an onclick event for the form field I use for the summary? Could that do the job?
Sure, you can do onclick events (for example showing DIVs of the clients records), but for this, you still need to use javascript to change the property of the DIV
avatar
Aliasalpha: How about making an onclick event for the form field I use for the summary? Could that do the job?
Well, if you don't want to use javascript, I suppose you could use the :target selector in CSS3 like this :

[i]<!doctype html>
<html>
<head>
<title></title>
<style type="text/css">
ul div {
display: none;
}
ul div:target {
display: block;
}
</style>
</head>
<body>
<ul>
<li>
<a href="#id1">
Click to expand...
</a>
<div id="id1">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</li>
</ul>
</body>
</html>[/i]

But browser support is limited (http://www.quirksmode.org/css/contents.html).

And like Ubivis said, there's not much interactivity you can do without Javascript (or the use of a plugin like Flash or Silverlight).
Hmm, seems that it'll have to be javascript, its the way coding is moving anyway so the chances of it not being available on the servers I'll be using is probably pretty low.

I can't seem to get javascript & php to run on the same HTML page though, is that possible or does it have to be a PHP page?

This code works when saved as a .php but not when saved as a .html, is that normal?
<html>
<head>
<script type="text/javascript">
document.write('<b>Javascript thinks you\'re an arsehole!</b>');
</script><p><i>
<?php echo "PHP agrees!" ?></i>

</head>
<body>
<p>HTML still thinks you're okay though
</body>
</html>
avatar
Aliasalpha: This code works when saved as a .php but not when saved as a .html, is that normal?
It's normal enough, but you can change it if you want. Your webserver will only let the PHP engine parse the source file (and then display its output to the client) if you've registered that extention (or any other type of filtering supported by the server) as containing PHP code. Add .html as a PHP type of document and your PHP code will be parsed/executed before the page is served to the client. The downside is that every .html document will then have to be fed through the PHP parser even if they don't contain any PHP code. Because of that, I'd recommend sticking to .php for PHP and .htm/.html for non-PHP.

When generating your pages with PHP remember that you can just as easily create javascripts as part of the page being sent as you can create normal html and css. I've used that to dynamically build javascript driven menues etc with actual content from a database.