php form control

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lmhart
Forum Newbie
Posts: 15
Joined: Tue Apr 14, 2009 1:05 pm

php form control

Post 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
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: php form control

Post 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>
 
lmhart
Forum Newbie
Posts: 15
Joined: Tue Apr 14, 2009 1:05 pm

Re: php form control

Post by lmhart »

thanks
Post Reply