jcstanley Posted December 4, 2008 Share Posted December 4, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/135566-submit-value-only-if-checkbox-is-ticked/ Share on other sites More sharing options...
VBAssassin Posted December 9, 2008 Share Posted December 9, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/135566-submit-value-only-if-checkbox-is-ticked/#findComment-710403 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.