Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 25th Dec 2016, 08:09 AM   #1
Warrior Member
 
Sviatoslav Volkov's Avatar
 
Join Date: 2016
Posts: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Default
How to submit form after CPA offer is completed ?
Share on: 
fb share twitter share gplus share more share

Hey guys, Merry Christmas to you all!
Im building a landing page and i want to have my form submitted after the CPA offer has been completed.
What i have tried so far is calling the widget function using javascript onclick.
But by doing this, my PHP form validation doesnt works.
Have any ideas how i can make it work ?
Here is my code:
Code:
<html>
<head>
<meta charset="UTF-8">
<title>Complete a survey to become part of our team.</title>

<!-- Start of content locker code -->

<noscript><meta http-equiv="refresh" content="0;url=https://www.appcaptcha.com/contentlockers/noscript.php" /></noscript>

<script type="text/javascript">var ogblock=true;</script>

<script type="text/javascript" src="https://www.appcaptcha.com/contentlockers/load.php?id=76db12dda6691911c8a119fe7043facd"></script>

<script type="text/javascript">if(ogblock) window.location.href = "https://www.appcaptcha.com/contentlockers/adblock.php";</script>

<!-- End of content locker code -->

</head>
<body>
      <?php
          $userErr ="";
          $emailErr ="";

          $url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
          if (strpos($url, 'error=user-empty') !== false) {
              $userErr ="Please enter your username!";

          }
          
          if (strpos($url, 'error=email-empty') !== false) {
              $emailErr ="Please enter your email!";
                  echo $emailErr;
          }

          if (strpos($url, 'error=email-incorrect') !== false) {
              $emailErr ="Please enter a valid email!";
                  echo $emailErr;
          }
          if (strpos($url, 'error=succes') !== false) {
              $entry = 'You have entered succesfully!';        
          }

      ?>
<h1> Please enter the following info: </h1>

<form method="post" action="enter.php">

Username: <input type="text" name="username" placeholder="Username" /> <br>

<span class="error"><?php echo $userErr ?></span><br>
E-mail: <input type="text" name="email" placeholder="E-mail" /><br>
<span class="error"><?php echo $emailErr ?></span><br>
Social Media: <input type="text" name="smedia" placeholder="Enter your Facebook, twitter, Skype, profile URL" /> (Optional)<br>
<input type="submit" value="Enter" />
<?php echo $entry ?>
</form>
</body>

</html>
And my enter.php file:

Code:
<?php

include 'connect-mysql.php';

    $username = $_POST['username'];
    $email = $_POST['email'];
    $smedia = $_POST['smedia'];
    
    if(empty($username)) {
            header("Location: index.php?error=user-empty");
            exit();

    }
    if(empty($email)) {
            header("Location: index.php?error=email-empty");
            exit();

    }
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
              header("Location: index.php?error=email-incorrect");
              exit();
    }
    else {

    $sql = "INSERT INTO user (username, email, socialmedia) VALUES ('$username', '$email', '$smedia')";

    $result = mysqli_query($dbcon, $sql);
    header("Location: index.php?error=succes");


    };
?>
Sviatoslav Volkov is offline  
Closed Thread


Bookmarks

Tags
cpa, form, offer, submit


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 03:14 PM.