Jump to content

hide unhide form


proctk

Recommended Posts

Below is code that I'm trying to edit so that when the link is clicked the form is shown and when the link is clicked a second time the form will be hidden

any idea how I can do this

[code=php:0]
  <p style="font-size:10px"><a href="index.php?pw_id=pw">Get new Password</a></p>

    <?PHP
// displays the lost password form
$pw_id = $_REQUEST['pw_id'];


if ($pw_id == 'pw'){ ?>
<form id="form1" name="form1" method="post" action="codeLostPassword.php">

  Email Address:
  <input type="text" name="email_address" id="email_address" />
  <input name="recover" id="recover" type="hidden" value="recover" />
 
  <input type="submit" name="Submit" value="Submit" id="Submit" />
  </form>
<?php }else{
  }
  ?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/30823-hide-unhide-form/
Share on other sites

You'll have to do that with javascript, not with php.

I'm not exactly a javascript wizard, but it's something among these lines:

first place your form in a div tag and assign an id to it. Set it's status to hidden. then set the properties for the buttom to: onclick="javascript: this.document.form1...'" you gotta look that part up somewhere :p
Link to comment
https://forums.phpfreaks.com/topic/30823-hide-unhide-form/#findComment-142138
Share on other sites

you're looking to do javascript. with php, you'll have to send a request to the server for it to parse your variable.

but with js is pretty simple just set an unique id for your form

and add an onclick = "javascript: document.getElementById('yourformid').style.display = 'hidden';"
Link to comment
https://forums.phpfreaks.com/topic/30823-hide-unhide-form/#findComment-142139
Share on other sites

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.