...

View Full Version : PHP button shows form



Eihn
05-25-2011, 05:21 PM
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.

mlseim
05-25-2011, 05:39 PM
Are you OK with javascripting, or does it need to be more secure ...
meaning, it can't be bypassed by disabling javascripting?


.

Eihn
05-25-2011, 07:32 PM
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.

Riceburner
05-26-2011, 10:37 AM
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:


<img id="button" onclick="show('HIDDENBOXES');" src="button.gif"/>

<fieldset id="HIDDENBOXES" class="hidden">
<input />
<input />
</fieldset>


Then use the following css:


.hidden { display:none;}
.shown { display:block; }


and the following javascript:


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.

bullant
05-26-2011, 10:57 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum