Creating an affiliate referral code generator, form, and processor script requires multiple components and technologies. Below, I'll outline a simplified example of how you can achieve this using HTML, JavaScript, and PHP. This example assumes you have a basic understanding of web development and server-side scripting.

1. HTML Form (index.html):

```html <!DOCTYPE html> <html> <head>

  <title>Affiliate Referral Code Generator</title>

</head> <body>

  <h1>Generate Referral Code</h1>
  <form id="referralForm" action="process.php" method="post">
      <label for="name">Your Name:</label>
      <input type="text" id="name" name="name" required><br><br>
      <label for="product">Product Name:</label>
      <input type="text" id="product" name="product" required><br><br>
      <input type="submit" value="Generate Referral Code">
  </form>

</body> </html> ```

2. JavaScript for Referral Code Generation (generator.js):

```javascript Generate a random referral code function generateReferralCode(name, product) { const randomChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; let referralCode = ''; Generate a 6-character code

  for (let i = 0; i < 6; i++) {
      const randomIndex = Math.floor(Math.random() * randomChars.length);
      referralCode += randomChars.charAt(randomIndex);
  }
  // Combine name and product
  return name.substring(0, 3).toUpperCase() + product.substring(0, 3).toUpperCase() + referralCode;

}

document.addEventListener(“DOMContentLoaded”, function () {

  const form = document.getElementById("referralForm");
  form.addEventListener("submit", function (event) {
      event.preventDefault();
      const name = document.getElementById("name").value;
      const product = document.getElementById("product").value;
      const referralCode = generateReferralCode(name, product);
      // Populate the referral code in a hidden input field
      const referralCodeInput = document.createElement("input");
      referralCodeInput.type = "hidden";
      referralCodeInput.name = "referral_code";
      referralCodeInput.value = referralCode;
      form.appendChild(referralCodeInput);
      form.submit();
  });

}); ```

3. PHP Script to Process Form Data (process.php):

```php <?php if ($_SERVER[“REQUEST_METHOD”] === “POST”) {

  $name = $_POST["name"];
  $product = $_POST["product"];
  $referralCode = $_POST["referral_code"];
  // You can store the referral code and associate it with the user in a database here
  echo "Referral Code: " . $referralCode;

} else {

  echo "Invalid request method.";

} ?> ```

In this example, the JavaScript code generates a referral code by combining the user's name and the product name with a random string. It then populates a hidden input field in the form with this referral code and submits the form to the PHP script. The PHP script can process the form data and store the referral code in a database or perform any other necessary actions.

Please note that this is a simplified example, and you should consider adding error handling, security measures, and database integration as needed for your specific use case.