Hello.. I have searched through various forums and I still have not found an answer to my problem, which I will try to describe in as many details I can:
I would like to know if it is possible in PHP (supported by MySQL) to create a form that is displayed in ONE page divided in categories -with many different field types- so that each category can be hidden or shown by clicking the appropriate "show/hide" button/link. The form would be like a "user preferences" page that someone logging in the site can find the submitted information in the future and edit them. If it can be created, is there a tutorial or example of such a form anywhere -about the hide/show attribute-??
Thanx,
Maroussa
long form in a single page with parts that can hide
Moderator: General Moderators
- greenhorn666
- Forum Commoner
- Posts: 87
- Joined: Thu Aug 14, 2003 7:14 am
- Location: Brussels, Belgium
I believe you should do that in JavaScript...
Cause this isn't really a server-side problem you have.
You could still do it in php, having each click on a hide/show button reloading the page AND submit the form, but with one special param that would tell the server not to make the changes persitent in the database, but only to use the submitted values to populate the forms field; and another one telling the server what to hide/show (I would do this param an int, one bit for every part of the form, meaning '0' all hidden, '1' part 1 showed, '2' part 2 showed, '3' part 1 and 2 showed,... I believe you won't have more than 32 parts to your form, so an int should do it).
Still JS would be easier I believe...
having each part being visible or not. But I think such stuff changes from browser to browser (see CSS)
Cause this isn't really a server-side problem you have.
You could still do it in php, having each click on a hide/show button reloading the page AND submit the form, but with one special param that would tell the server not to make the changes persitent in the database, but only to use the submitted values to populate the forms field; and another one telling the server what to hide/show (I would do this param an int, one bit for every part of the form, meaning '0' all hidden, '1' part 1 showed, '2' part 2 showed, '3' part 1 and 2 showed,... I believe you won't have more than 32 parts to your form, so an int should do it).
Still JS would be easier I believe...
having each part being visible or not. But I think such stuff changes from browser to browser (see CSS)
-
tylerdurden
- Forum Commoner
- Posts: 66
- Joined: Mon Jul 28, 2003 11:52 am
- Location: Austria
Something like this should work:
Code: Select all
<html>
<head>
<title>Javascript hide show</title>
<meta name="generator" content="BBEdit 7.0">
<style type="text/css">
<!--
#partone { visibility: hidden}
#parttwo { visibility: hidden}
-->
</style>
<script type="text/javascript" language="Javascript">
<!--
function doIt(which) {
document.getElementById(which).style.visibility = "visible";
}
//-->
</script>
</head>
<body>
<a href="#" onClick="doIt('partone')">show1</a><br><br>
<a href="#" onClick="doIt('parttwo')">show2</a><br><br>
<form>
<table>
<tr id="partone">
<td>partone:</td><td><input type="text"></td>
</tr>
<tr id="parttwo">
<td>parttwo:</td><td><input type="text"></td>
</tr>
</table>
</form>
</body>
</html>