Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return a POST variable on confirm #16

Open
colinmackinlay opened this issue Dec 29, 2015 · 1 comment
Open

Return a POST variable on confirm #16

colinmackinlay opened this issue Dec 29, 2015 · 1 comment

Comments

@colinmackinlay
Copy link

Hi, great plugin - works so easily.

I often have a number of submit buttons that call the same page which then reads for their POST variable names to determine the right action to take. For example I'm trying to use this on a page where two options are:

form action='/pageref.php' method='post'>
input name="delete" type="submit" class="button small expand alert" value="Delete all data!" data-confirm/>
input name="download" type="submit" class="button small expand success" value="Download all data as CSV">
/form>

pageref.php checks for these with:

if (isset($_POST['delete])) {
...
}
if (isset($_POST['download])) {
...
}

The trouble I'm having is that inserting the data-confirm gives the expected modal dialogue box but when pageref is called the $_POST['delete'] has been lost so I can't confirm the button was pressed. It's become a bit too safe!

Am I missing something obvious or is this a limitation - I could call a different page with this button as a workaround and after performing the action set the headers to the page I want it to go to I suppose.

PS If I use data-value="Do you really want to do this?" so that it uses the window dialogue then the POST variables are set correctly

@colinmackinlay
Copy link
Author

Put more simply. Consider this example in a form that posts back to its own page:

`

`

Nothing gets printed out by the php echo

`

`

This uses the windows fallback and the php echo outputs testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant