www.webdeveloper.com
Results 1 to 4 of 4

Thread: Submit form to two places

  1. #1
    Join Date
    Sep 2013
    Posts
    1

    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;
    }

  2. #2
    Join Date
    Mar 2013
    Location
    Iasi, Romania
    Posts
    53
    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' )
    I'm sorry I keep looking at your chest while you're talking. It's just so beautiful. What is it, oak?

  3. #3
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,204
    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
    PHP Code:
    global $mysubscribe2;
    $mysubscribe2-&gt;email $email;
    if ( &
    #039;1' !== $mysubscribe2-&gt;is_public($mysubscribe2-&gt;email) ) {
    $mysubscribe2-&gt;add($this-&gt;email);
    $status $mysubscribe2-&gt;send_confirm(&#039;add'

    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.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  4. #4
    Join Date
    Sep 2013
    Posts
    221
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles