0

I have a standard HTML form which on submission saves the data to a database, but I need to integrate Dot Mailer into it. Dot Mailer is the same sort of thing as mail chimp.

The main issue I'm having is how to send the POST data to two separate pages. I've had a look at using ajax as a solution, but I can't get it to work and would rather a php based solution.

Is there a way to instantly send post data to two files? Dot Mailer gives me an address to send the data to and what to call the names of the fields. I have seen examples with hidden text fields, but I don't want the user to have to click submit.

Any help would be greatly appreciated.

Community
  • 1
  • 1
Elliot
  • 63
  • 1
  • 8
  • Why do you need two pages? Why don't you write one page that updates the database and also calls the Dot Mailer API? – Barmar May 23 '14 at 15:08
  • Not sure what you mean by "would rather a php based solution". AJAX sends to a server script, that will be in PHP. You can make multiple, concurrent AJAX calls from one web page. – Barmar May 23 '14 at 15:10
  • If you can't get it to work, we can help with that. Post what you tried. – Barmar May 23 '14 at 15:10

1 Answers1

0

you could try to use javascript and PHP

You get the POST data in a php script and save it to a database with the same POST data you generate another form, like:

    <?
    $mysaved = saveToDatabase($_POST['MyField1']); ?>
    ?>     


<form  action="/dotmailer.com/whatever.php" >
    <input name="MyField1" value="<? echo $_POST['MyField1'];?> />
    </form>

    <script>
    form.submit();
    </script>
Alex Angelico
  • 3,710
  • 8
  • 31
  • 49