Jump to content

Form submission: Runs automatically when submit button hasn't been pressed


halben
Go to solution Solved by halben,

Recommended Posts

I have the following: 

.. This is the button with hidden type ..

<input type="hidden" name="s2member_pro_paypal_registration[nonce]" id="s2member-pro-paypal-registration-nonce" value="xxx">
<input type="hidden" name="s2p-option" value="">
<input type="submit" name="r_submit" id="s2member-pro-paypal-registration-submit" class="s2member-pro-paypal-submit s2member-pro-paypal-registration-submit" value="Register" tabindex="1000">

My code to detect the submit button:

if (!isset($_POST['r_submit']) && $_POST['s2member_pro_paypal_registration']['nonce'] == 'xxx') {
    // Do nothing
} else {
    var_dump($something);
    // Do something
}

My site spits out 

var_dump()

 automatically when the form hasn't been submitted yet and I'm not sure why.

 

Can someone please help me?

 

Thanks,

Hal

Edited by halben
Link to comment
Share on other sites

  • Solution

Figured it out. I had to use the hidden type instead of the button name. It's weird. For the plugin, I had to custom insert a button name value so when the submit button has been pressed, it could read it. But for some reason, it wasn't reading the name value from the button.

 

Thanks for helping.

Link to comment
Share on other sites

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.