/    Sign up×
Community /Pin to ProfileBookmark

Submit form to two places

I am just learning PhP, and need to modify a form. It’s currently submitting an email address to a newsletter subscription database, and I also need it to submit the same email address to the Subscribe2 WP plugin. Any suggestions for how to do this? I may need to be walked through it as I am quite new to this. Thanks!

Here is the current form:

<form method=”post” action=”http://oi.vresp.com?fid=62c0b66827” target=”vr_optin_popup” onsubmit=”window.open( ‘http://www.verticalresponse.com‘, ‘vr_optin_popup’, ‘scrollbars=yes,width=600,height=450’ ); return true;” >

<div style=”font-family: verdana; font-size: 11px; width: 110px; padding: 7px; margin: 0 12px; border: 1px solid #8D8368; background: #8D8368″>
<strong><span style=”color: #ffffff;”>Sign Up For Newsletter</span></strong><br/><br/>
<label style=”color: #ffffff;”>Email Address:</label><br/>
<input name=”email_address” size=”12″ style=”margin-top: 5px; border: 1px solid #999; padding: 3px;”/><br/>
<input type=”submit” value=”Subscribe” style=”margin-top: 5px; border: 1px solid #999; padding: 3px;”/><br/>
</div>
</form>

It needs to be combined with this code, to submit the email address to Subscribe2.

global $mysubscribe2;
$mysubscribe2-&gt;email = $email;
if ( &#039;1&#039; !== $mysubscribe2-&gt;is_public($mysubscribe2-&gt;email) ) {
$mysubscribe2-&gt;add($this-&gt;email);
$status = $mysubscribe2-&gt;send_confirm(&#039;add&#039?;
}

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@ssdogSep 20.2013 — Here is a tip for you: you have that onsubmit in your form, you could create a function that sends your data via AJAX requests wherever you need, then call
[CODE]window.open( 'http://www.verticalresponse.com', 'vr_optin_popup', 'scrollbars=yes,width=600,height=450' )[/CODE]
Copy linkTweet thisAlerts:
@rootSep 20.2013 — 
  • 1. You are reliant on people not running popup blockers

  • 2. use of CSS would help improve your code readability as would use of the forum tags to highlight code

  • 3. this code [code=php]global $mysubscribe2;
    $mysubscribe2-&gt;email = $email;
    if ( &#039;1&#039; !== $mysubscribe2-&gt;is_public($mysubscribe2-&gt;email) ) {
    $mysubscribe2-&gt;add($this-&gt;email);
    $status = $mysubscribe2-&gt;send_confirm(&#039;add&#039;
    }[/code]


  • seems to be part of a function. Are you wanting to send the same information to two email addresses? if so, it only needs the mail() function repeated with the destination information set.
    Copy linkTweet thisAlerts:
    @priyankagoundSep 21.2013 — you cannot do it using simple form post submit. but you can do it using AJAX.

    as you soon as you call submit() fn, the data from the form is posted to the action url page. hence you might end up page being loaded.
    ×

    Success!

    Help @perlund spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.14,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...