Hi to all,
please tell me any easy php code,
To 'show' and 'hide' a new form file (may be called as "form1.php")
on same current page
by click on radio buttons ?
Any suggession will be appreciated,
Thanks and Regards
Hi to all,
please tell me any easy php code,
To 'show' and 'hide' a new form file (may be called as "form1.php")
on same current page
by click on radio buttons ?
Any suggession will be appreciated,
Thanks and Regards
If you want a radio button to control what is displayed on a page without reloading the page, you'll need to use javascript. If I misunderstood what you are asking about, post again.
MSK7 (02-04-2009)
Please suggest,
How javascript codings can help me in easy way, To "show" and "hide" any other new form file (may be called as "form1.php") on my other current page,
on click of radiobuttons.
Thanks & Regards.
I'm not that great with javascript. You should post your question in the javascript section.
Good Luck!
It should be in the JavaScript section yes, but here is a stab at it anyway:
HTML: (remember you need to save this as .php as well)
May not be the best way to do it, but gets the job done.Code:<html> <head> <title>Hide Form</title> <script type="text/javascript"> function showForm(){ var form = document.getElementById("hiddenform"); form.style.display='block' } </script> <style> #hiddenform{ display:none; } </style> </head> <body> Bla bla this text is visible and all my content is here. <form> <input type="radio" onclick="showForm();" name="show" value="On">On<br /> <input type="radio" name="show" value="Off">Off </form> <div id="hiddenform"> <?php include("form1.php"); ?> </div> </body> </html>
Good Luck!
Some refinements to Schmoopy's code
There is no need for the 'Off' radio button unless we need to hide the form, I have added it here. Additionally some misc changes in JS side. As he mentioned this approach will work under normal circumstances.Code:<html> <head> <title>Hide Form</title> <script type="text/javascript"> function showForm(flag) {document.getElementById('hiddenform').style.display = flag === 1 ? 'block' : 'none';} </script> <styletype="text/css"> #hiddenform {display: none} </style> </head> <body> Bla bla this text is visible and all my content is here. <form> <input type="radio" onclick="showForm(1);" name="show" value="On">On <br/> <input type="radio" name="show" value="Off"onclick="showForm(0);">Off </form> <div id="hiddenform"> <?php include("form1.php"); ?> </div> </body> </html>
Bookmarks