TOPIC:

Compare field value with value in database? 6 years 2 weeks ago #130491

  • Topic Author
  • Tohm
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 3
  • Thanks: 0
Hi everybody,

For a marketing game, I need my visitor to fill a form with a special code (8 characters and numbers).
To validate the field, I need to verify if the typed code is already stored in a db table (game_codes).

If not, the visitor has to be redirected to a failure page.

If yes, I need to check if somebody else has already successfully submitted a form
between a fixed date and time and $this new submission.

If someone did, the visitor is redirected to a failure page.

I not, the visitor is redirected to a success page.

I really need help as I haven't any clue!

Ideas?

Thx

Tom

Please Log in or Create an account to join the conversation.

Compare field value with value in database? 6 years 2 weeks ago #130535

  • lennerd
  • Offline
  • Developer
  • Developer
  • Posts: 4669
  • Karma: 72
  • Thanks: 411
Hello Tom,

all this sounds possible but will need a little coding PHP.

The general approach would be to use php in Form->properties->advanced->more options->submit pieces->end submit-> custom

There you can do something like this:

//Load the library
$this->execPieceByName('ff_initLib');

//Load the form value

$myformvalue=ff_getSubmit('NameOfElement');

// start sql queries
//the following query is just a pseudo query which needs custumized to fit your needs

$db = JFactory::getDBO();
$db->setQuery("Select title, id From #__tags Where id = '".$myformvalue."'");
$result= $db->loadResult();

// now check the result from the DB and redirect

if($result == 'somevalue'){
ff_redirect('/myThankYouPage.php');
}
if($result == 'someothervalue'){
ff_redirect('/myfailurePage.php');
}


Once again the code above needs to be customized to fit your requirements, but it shows how it could be done.

I hope this helps to get started.
Regards,
Stefan

===============================================
Satisfied? Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
===============================================

Please Log in or Create an account to join the conversation.

Compare field value with value in database? 6 years 2 weeks ago #130775

  • Topic Author
  • Tohm
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 3
  • Thanks: 0
Thanl you very much, it works perfectly.

Tom

Please Log in or Create an account to join the conversation.

Compare field value with value in database? 6 years 1 week ago #131050

  • pedro81's Avatar
  • pedro81
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 15273
  • Karma: 287
  • Thanks: 1076
Great!

Let us know if you have further questions.

Please Log in or Create an account to join the conversation.

Compare field value with value in database? 2 weeks 3 days ago #250655

  • stleone
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 1
  • Thanks: 0
Stefan -

Your solution in this post is exactly what I need, but it is outside my area of expertise even with your explanation. I would like to hire you to do exactly this. Can you please email me at stleone@shorelineinternet.com?

Thank you
Scott

Please Log in or Create an account to join the conversation.

Compare field value with value in database? 2 weeks 2 days ago #250674

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 2267
  • Karma: 3
  • Thanks: 210
Hi,

Stefan no longer works for crosstec, but I can help you.
Have you tested this solution?

Regards,
Tihana

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.050 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!