Jump to content

Update 2 coulmns if checkbox is checked


jcstanley

Recommended Posts

Hi

 

I am using dreamweaver CS3 to create my site.

 

I have a form which enables an admin user to edit a member's details - one of the options being able to reset the password for that user back to the word "password".

 

A check box which submits a value of 1 if it is ticked and stores it in the "reset" column of the database. 

 

When the user attempts to login a query checks the value in the "reset" column. 

 

If the value is 1 then the reset password page is displayed, if the value is 0 they login as normal.

 

Anyway, the problem I have is how do I update the password field (to the word password) only if the reset password checkbox is ticked when the form is submitted?

 

I have had a play around with Custom Transactions/Triggers but can't figure it out.  Basically I think i need an IF statement to execute when the form is submitted.

 

Any ideas how this can be done?

 

Hope this makes sense!

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/135783-update-2-coulmns-if-checkbox-is-checked/
Share on other sites

Question is not so clear. Is your password encrypted ? by using base64 or md5 then you need to decode it. Two way its mostly encode and decode, either by your front page, or from mysql function itself.

 

$password = "helo";

$encrypt_pwd = base64_encode($password);

($password == $encrypt_pww) ! true : false;

 

$decrypt_pwd = base64_decode($password);

($password == $decrypt_pwd) ! true : false;

 

 

 

Hi shamuntoha

 

No, the passwords are not encypted.

 

Basically the problem is, when the form is submitted with the reset password checkbox checked (value = 1), the value is stored in the reset column of the table, but the password coulmn in the same table also needs to be updated to the word "password".

 

Is this possible or is there a better way?

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.