submitting $_POST data to a script without using a form

Permabanned
Joined
25 Oct 2004
Posts
9,078
As per title, is it possible to submit form data via $_POST to a script without using the forms submit button.

IE

If i have a security feature on a form that uses PHP_SELF as its action, does some magic behind the scenes and then submits the rest of the $_POST data to a phpmail script providing the security feature returns a "true".

Any help appreciated :D
 
Its not without user action so to speak, basically I have a form which people can fill out and part of the form has security information.

If that security information is invalid nothing happens, all they get is a "doh you forgot to fill in the security information" without refreshing the form/page.

If they get it right, i want to resubmit the form to my mail script, which requires variables are passed using $_POST.

So what im looking for is a way to resubmit data after a user has already clicked submit once.
 
Its not submitting to the user.

What its basically doing is

user enters security information -> user clicks submit -> using PHP_SELF the form self validates -> security code is correct -> $_POST data is sent to phpmailer script

As the form itself has action="<?php echo $_SERVER['PHP_SELF']; ?>" instead of bypassing the security and just using action="phpmailer.php"
 
Its the security that is messing it up indeed, the form has full validation etc but some muppet decided to use a charity website to bombard our server with spam emails so I had to implement additional security, one of those features is captcha, unfortunately because of how the php email script is set up it requires data be passed to it using $_POST.

Now i can quiet easily implement the security without needing to check its ok before submitting the form, but by doing that if the code is wrong all previous form data is lost and user has to input it all again.

What im attempting to do is, when the user clicks on submit it validates all form data and providing the security questions are correct, submits it all to the php mail script using $_POST so that it can continue on with emailing the form data to who ever. If the code is incorrect, well the data is still there for them, so they only need to change the security codes.
 
Back
Top Bottom