Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    May 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP button shows form

    I have a red button and 4 textboxes, and i want the textboxes to be invisble until i click the red button. how can i achieve this in php? Thanks.

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,531
    Thanks
    8
    Thanked 1,091 Times in 1,082 Posts
    Are you OK with javascripting, or does it need to be more secure ...
    meaning, it can't be bypassed by disabling javascripting?


    .

  • #3
    New to the CF scene
    Join Date
    May 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    does not need to be secure,

    The page needs to be written in php and interact with other variables I have defined on the site for validation reasons.

    1st button will show the contents of the table plus an accept button for users to accept the job.

    2nd button will show a form to insert a new row in database for someone to accept

    3rd button will show previous records that have been completed.

    im very familiar with c#/asp/sql but not with php. if anyone wants to help me out with this project i would be willing to pay about $50 for this.

  • #4
    New to the CF scene
    Join Date
    May 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    As long as you're happy for the text-boxes to appear on the page when css is off, then this is an HTML/CSS/Javascript fix:

    simply wrap the textboxes in the following code:
    Code:
    <img id="button" onclick="show('HIDDENBOXES');" src="button.gif"/>
    
    <fieldset id="HIDDENBOXES" class="hidden">
    <input />
    <input />
    </fieldset>
    Then use the following css:
    Code:
    .hidden { display:none;}
    .shown { display:block; }
    and the following javascript:
    Code:
    function show(id) {
      if(!document.getElementById) { return; }
      obj = document.getElementById(id);
      if(obj) {
          if(obj.className.match("hidden")) { obj.className = obj.className.replace(/hidden/, "shown"); }
          else if (obj.className.match("shown")) {  obj.className = obj.className.replace(/shown/,"hidden");  }
          else {obj.className = obj.className + " shown"; }
      }
    }
    you can do it cleaner with jQuery, but this works in the vast majority of modern browsers.

  • #5
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Quote Originally Posted by Eihn View Post
    The page needs to be written in php and interact with other variables I have defined on the site for validation reasons.
    Since it must be written in php you could attach onclick event handlers to each button with appropriate parameters in the event handler's url to show which button was clicked.

    The event handler reloads the current page and at the top of the page you detect which button was clicked and then get php to create the appropriate html and/or css required to show the content to be displayed for that button.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •