Sizo
Sizo

Reputation: 89

mailto and redirect together

i want to do submit and after if isset $_POST :

mailto fonction
mysql query SELECT.
do refresh.

but one of these not work,

my example:

if(isset($_POST['submit'])) {
    header("location: mailto:[email protected]" );
    mysql_query("UPDATE  bla bla bla");
    header("location: index.php....." );
};

idea is click on the button, open outlook window, do mysql update and refresh.

without refresh its work.

without mailtto also work.

but 3 function together

TNX

Upvotes: 0

Views: 775

Answers (1)

Twisty
Twisty

Reputation: 30903

This will fail. You need to send the mail in another method, don't use:

header("location: mailto:[email protected]" );

Try something like:

if(isset($_POST['submit'])) {
  mail("[email protected]", "Form Posted Response data", print_r($_POST));
  mysql_query("UPDATE  bla bla bla");
  header("location: index.php....." );
};

And as always Do Not Use MySQL - it is no longer supported. Switch to MySQLi or PDO and start using Prepared Statements to protect from Injection.

Upvotes: 1

Related Questions