Jump to content

Is this even possible?!?!?


nine72

Recommended Posts

And if so how....

OK, got some good instruction from nice people in the PHP secetion now looking for a bit of Ajax to go with.
What I need to do is this...
User enters a 4 digit code into the text field and to the right I need to have it print the definition of what that nubmer is.

| Text Box |  print definition of text input.

exp.  MCC Code: | 5942 |  Book Stores

This needs to happen instantly or when they loose focus on that field. My forms are in sets of AJAX tabs.

The codes are Merchant Class Codes for the Credit Card Industry they define risk, discounts, charge fees, reserve % etc. The code is what gets passed to my xml generator. The def is for the data monkeys that enter this stuff so they have an "at a glance" notice that they have the right MCC.

There are no catagories for these codes, they are a long list of code numbers and def provided by VISA/MasterCard (they use the same codes to set rates). and since a business that sells widgets might be MCC 1000 and a business that sales boxes might be 8000 but a shop that sales widges and boxes might be a 4550. and then again depending on the person that sold the merchant the processing service might say that they are a 0785 for general sundries. its nutty.

This is the php help that I received and it si good ( i was over thinkning what I needed to do...)
<?php
// Get the code passed from the form field
$mmc = $_GET['mmc'];

// Path to your code file
$filepath = 'mmc_codes.txt';

// Create an array of the file contents
$codes = file($filepath);

// Loop through the results
foreach ($codes as $code){
  list($c, $d) = explode(' ', $code); // Split the line on a space ($c is code, $d is description)
  if ($code == $mmc){
      echo $d;
  }
}
?>
(THANKS TO HUGGYBEAR FOR THIS PART!!)

so now i would need the ajax to make it print "instantly" in on the form...any and all suguestions and help welcome.

thanks
nine72
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.