Jump to content

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 checkbox is ticked when the form is submitted?

 

I have had a play around with Custom Transactions 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/135566-submit-value-only-if-checkbox-is-ticked/
Share on other sites

Hello,

 

Your main topic content above didn't make much sense to me, so i'm gonna go by your topic title "Submit value only if checkbox is ticked".

 

Basically, you have two options (server side, client side).

 

Client side will require some javascript:

 

<form onsubmit='javascript:if (document.getElementById('id_of_checkbox_here').checked == false) { return false; } ;'>

 

Server side (PHP):

 

if (isset($_POST['checkbox_name_here'])) {
//code here if the checkbox was ticked
} else {
//code here if the checkbox was NOT ticked
}

 

Hope that helps.

 

Kind regards,

Scott

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.