Jump to content

making input field appear and disappear


php_novice2007

Recommended Posts

Hi,

 

I'm writing a page which allows someone to reset their password. I have 2 text fields for them to type in the new password 2 times. I want to have a check box above them so that when the user clicks on the check box, these two fields appear, otherwise they should be hidden.

 

How can I go about doing this? I can't seem to find any tutorial on how this can be done either..

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/58343-making-input-field-appear-and-disappear/
Share on other sites

ok, there is a javascript function to reload() the screen and this you can start by making onclick event for your check box, then you make use of if-then statement to verify that when the checkbox is selectect you display the fields. this fields will be displayed inside your if-then statement, i.e

 

if ($_POST["chkMe"])

{

 

  display your text fields here...

}

 

I hope u do understand what I'm saying,

You don't need to reload the page.

 

google javascript div toggle for some examples on how to show/hide an element. with the onclick even of the checkbox you can call the function that shows are hides the bits you want.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.