Page 1 of 1

php form control

Posted: Tue May 26, 2009 5:25 pm
by lmhart
I am needing some direction.

I am wanting to code a page where clicking on a button it will show a form on the same page. I am very new to php. If I were to do this in .net I would simply set the form to visible on click. I am not quite sure how to do this i php. Their is no processing to be done.

Code: Select all

 
pseudo code
onload
 user input form = hidden
 admin input form = hidden
 
 
if button 1  is selected
   then show user input form
if button 2 is selected 
   then show admin input form
 
I have googled it and have been unsuccessful in finding any examples.

Thanks
Mark

Re: php form control

Posted: Tue May 26, 2009 5:31 pm
by Zoxive
This requires javascript/css (client side), as php is server side.

Ex:

Code: Select all

 
<html>
<head>
  <style type="text/css">
    #divname{
      display:none;
    }
  </style>
  <script type="text/javascript">
    function show(){
      document.getElementById('divname').style.display = 'block';
    }
  </script>
</head>
<body>
  <a href="#" onclick="show()">Show</a>
  <div id="divname">
    MY STUFF TO SHOW
  </div>
</body>
</html>
 

Re: php form control

Posted: Thu May 28, 2009 11:21 am
by lmhart
thanks