Forum Moderators: coopster

Message Too Old, No Replies

PHP Submission Form Help

         

sess4561

11:43 am on Feb 8, 2010 (gmt 0)

10+ Year Member



Hi guys.

I need some help with a client of mines website.

Basically, the front page has a simple form that captures (name, email, and tel etc), and the price of their home.

On the second page, the information from the first page is stored on a Mysql database, and the customer is given an offer for their home.

They are presented with another form that asks if they accept the offer or not.

This then updates the Mysql database if they click 'yes' 'no' or 'maybe'.

The problem I am having is the client has now introduced a third party into the equation.

As well as the system I have developed, they also want the information, including the second set of information to be submitted via an iframe to another company.

At the moment I have created a third page, which asks the user to confirm their information.

Obviously this is not ideal, as not every customer is not going to resubmit their details.

Is there anyway I can build a timer of some sort into my database that waits 10 mins or so to see if the customer clicks 'yes' 'no' 'maybe', and then submits it to the other companies database?

The code they have given me looks like this:-

CustomEnquiry.aspx?NM=<? echo $name; ?>&EM=<? echo $email; ?>&PH=<? echo $tel; ?>&PC=<? echo $postcode; ?>&VL=<? echo $propvalue2; ?>&BMV=<? echo $bmvpercentage; ?>&OF=<? echo $acceptbmv; ?>

the echo $'s, are my variables, but they need all of this info sent across.

Hope someone can help.

TheMadScientist

9:36 pm on Feb 8, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Personally, I'd use AJAX to submit the same form (or the necessary info) to the second location... It requires a more detailed explanation than I can post right now, but hopefully it will give you some direction.

CyBerAliEn

10:02 pm on Feb 8, 2010 (gmt 0)

10+ Year Member



AJAX would be a good solution. You could create a custom function that uses AJAX to submit the form details to this 3rd party just before the form is submitted normally to your site. Then you both get the data.

Another option... if you are collecting the info on your end and then need to submit the data to the 3rd party... you could write a PHP script that runs periodically via your server's CRON. This script would query your database for new entries (would probably want to add a new column to toggle like 'data_sent' as either true or false so duplicate data does not get sent) and the PHP script could then use PHP functions to send the data to this other website.

Given the two... it would probably be easiest to run with AJAX. You would just need a simple AJAX function and perhaps one additional wrapper function to actually send your form data through it. The user would never know it is happening.

rocknbil

3:50 am on Feb 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard, sess4561.

A word for your boss - he had better do something to make sure the user is aware their information is being shared with a third party. Even if it's not private sensitive info - which it is, you're passing off the email and phone - this is a good way to kill user trust and/or get sued. What they are doing here is taking away the user's right to choose where their data does - or does not - go.

With that in mind, we can take it out of the closet and use it as an upsell: "Get even more buyers for your home, submit to X properties." Everyone wins.

That being said . . . if the white path is chosen, the solution is obvious. :-) If not, an alternative to adding another layer of technology (which will fail if JS is disabled) requires one answer:

.... waits 10 mins or so to see if the customer clicks 'yes' 'no' 'maybe', and then submits it to the other companies database?


The question is, does the user's response affect the disposition of the submitted data? That is, if they say "no" the third party gets no info? If this is true, modify the below accordingly.

I'd do this via a simple cron, completely transparent, and you'd only have to run it once an hour. You would add a field to your database, boolean or tinyint, and once sent, it gets marked to 1 or true, so it doesn't get sent again.

To make it **really easy** you'd just ask them for the email to send the data to, and compose a mailer as the cron. Open the DB, get leads where sent=0, done, run it once a day, once an hour, whatever.

If they want the thing submitted through the form, just curl it with the data as presented.