halben Posted October 17, 2013 Share Posted October 17, 2013 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 Link to comment https://forums.phpfreaks.com/topic/283062-form-submission-runs-automatically-when-submit-button-hasnt-been-pressed/ Share on other sites More sharing options...
codefossa Posted October 17, 2013 Share Posted October 17, 2013 If $_POST['r_submit'] is set or $other_post == $x then do nothing. I think you want to use OR (||) rather than AND (&&). Link to comment https://forums.phpfreaks.com/topic/283062-form-submission-runs-automatically-when-submit-button-hasnt-been-pressed/#findComment-1454315 Share on other sites More sharing options...
halben Posted October 17, 2013 Author Share Posted October 17, 2013 I tried using OR (||) and it doesn't work. Any more suggestions? Link to comment https://forums.phpfreaks.com/topic/283062-form-submission-runs-automatically-when-submit-button-hasnt-been-pressed/#findComment-1454317 Share on other sites More sharing options...
halben Posted October 17, 2013 Author Share Posted October 17, 2013 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 https://forums.phpfreaks.com/topic/283062-form-submission-runs-automatically-when-submit-button-hasnt-been-pressed/#findComment-1454326 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.