Cless Posted July 8, 2007 Share Posted July 8, 2007 Hello, I recently re-did my Registration Script to have more secure functions. One of those things is using the same page for Registration, and seeing if a certain variable is set. However, the certain Submit function I am using will not set the name="" part. <p class="right"><input type="submit" value="Register" name="RE_Submit" class="BasicInput" onclick="this.disabled = 'true'; this.value = 'Registering...'; this.form.submit();"/></p> Basically, this makes it so, when you click it, you can not click it twice. It will become unclickable, so, the user can not submit the same information twice. It works fine... until I put name="RE_Submit". It'll still disable it, and blah blah, however, the name part won't work... At the start of the script, I have it set so $RE_Submit= $_POST['RE_Submit'];. If it is set, it will display a confirmation message. If not, it will display the form. *This is not Javascript. It won't even work if I try to set it to Javascript. O: Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/58946-solved-submit-button-problems/ Share on other sites More sharing options...
wildteen88 Posted July 8, 2007 Share Posted July 8, 2007 As you are disabling that form field when you press it the browser will exclude it in POST data. What you might want to do is hide the button when it is clicked and then display a message in replacement eg: <?php if(isset($_POST)) { echo '<pre>' . print_r($_POST, true) . '</pre>'; } ?> <script type="text/javascript"> function hide_btn(sbt_btn) { // Dide the submit button when clicked sbt_btn.style.display = 'none'; // Display a message in replacement document.getElementById('submit_btn_msg').style.display = 'block'; } </script> <form action="" method="post"> Name: <input type="text" name="username" /><br /> Password: <input type="password" name="password" /><br /> <input type="submit" id="sbt_btn" name="RE_Submit" value="Register" onclick="hide_btn(this);" /> <!-- the following will be shown when the form is submitted and the submit button will disappear --> <span id="submit_btn_msg" style="display:none">Registering...</span> </form> Quote Link to comment https://forums.phpfreaks.com/topic/58946-solved-submit-button-problems/#findComment-292496 Share on other sites More sharing options...
Cless Posted July 8, 2007 Author Share Posted July 8, 2007 Yay! Thanks a lot. It worked. Quote Link to comment https://forums.phpfreaks.com/topic/58946-solved-submit-button-problems/#findComment-292532 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.