We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18995
    • 13 Posts
    Hello,

    I’ve created a new checkbox field in my registration form for people who wish to recieve a newsletter. I want to use a 3rd party email applcation to store and send the emails from. So i have created an new page with a snippet call that runs in between the sign up and success page. However, I’ve not been able to pull out the values from the web sign up form. For example,

    if (isset($eshot)) {
    if ($eshot=="eshotTrue") {

    Can someone please explain the code i need to use to check values from the webloginpe registration form?
      www.mediagang.co.uk: Developing your business online
      • 10449
      • 956 Posts
      Where or what is $eshot? A $_GET or $_POST form-variable / -field? In that case, you need to use $_GET["eshot"] or $_POST["eshot"].

      Or is that an additional snippet parameter you’ve added yourself?
        • 18995
        • 13 Posts
        Thanks for your reply, let me try and explain what i’m trying to achieve a little better..

        In my webloginPE registration page i have use the following:

        [!WebLoginPE? &type=`register` &regType=`instant` &registerTpl=`registerForm` &tosChunk=`Terms` &regRequired=`email,username,fullname,password` &customFields=`eshot` &inputHandler=`Tick the box to confirm you would like to be sent our newsletter:eshotTrue:eshot:checkbox:()` &regSuccessId=`240` &regSuccessPause=`0` !]

        using the: &customFields=`eshot`

        &regSuccessId=`240` is the new page that contains my snippet. The purpose of this snippet is to check if the eshot tick box has been checked and if so, to add the users details (email and name) to a 3rd party application. After this is then continues to redirect to the registration confirmation page.

        The problem i’m having is checking that the &customFields=`eshot` has been checked. Basically getting the values from the webloginPE registration page.
          www.mediagang.co.uk: Developing your business online
          • 18995
          • 13 Posts
          I think the values were not getting passed from webloginpe.class.php to my snippet. So i figured i would add my code into this page instead. It is now picking up the values but still not updating the email database. This code does work in other pages, when called in a snippet.

          Is it possible to run curl commands in this page?

          Is there a better way of doing this?

          Here’s the code that i have added:

          PHP is not my strenght so, hope someone can help..

          // EVENT: OnBeforeWebSaveUser

          /**
          * Add New Web Users to Mail Build If Newsletter is ticked.
          * Line 736
          */

          if (isset($_POST[’eshot’])) {
          if ($_POST[’eshot’]=="on") {

          // Send contact data to mail manager

          //Get data from contact_us form

          $detailsURL="http://www.mydomain.com/a/c/";

          if (isset($fullname)) {
          $contactFields=’mb-name=’.$fullname;
          }
          if (isset($email)) {
          $contactFields.=’&mb-niyud-niyud=’.$email;
          }

          if (isset($registerContactTelephone)) {
          $contactFields.=’&mb.f-iljrk=’.$telephone;
          }

          if (isset($registerContactCompany)) {
          $contactFields.=’&mb.f-iljru=’.$company;
          }

          if (isset($registerContactCountry)) {
          $contactFields.=’&mb.f-iljyl=’.$country;
          }

          $referer="";

          // Send data to mail manager

          $ch = curl_init();
          curl_setopt($ch, CURLOPT_URL, $detailsURL);
          curl_setopt($ch, CURLOPT_POST, 1);
          curl_setopt($ch, CURLOPT_REFERER, $referer);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
          curl_setopt($ch, CURLOPT_POSTFIELDS, $contactFields);
          $ret = curl_exec($ch);
          curl_close($ch);
          }
          }
            www.mediagang.co.uk: Developing your business online