Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/58946-solved-submit-button-problems/
Share on other sites

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>

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.