Before beginning, please download this code. Unzip and upload it to your site. This is what you will be editing and using for your pre-population. First off, you are going to point your first page with the form to this new page you just downloaded (process.php). That way when your traffic clicks submit, it quickly displays process.php for about half a second setting the proper cookies, and then redireting them to your order page. Next, you are going to set variables for each field name in your form. The highlighted images below are the areas that you need to replace with the name of your form fields (this will set your variables with the potential buyer's info which will be stored in cookies). Just make sure you maintain the quotations format. For instance, if you have a form field that is named 'first_name', you would change the highlighted parts in the variable string titled '$first_name' to 'first_name'. Next look for this line $hostname = '.testsite.com'; it should be around line 46 in your code. Once you have found that, change the text inside the quotation marks to your URL. Dont include "www. or http://" but do add a period in front of ur url like we did above. So now you must store these variables into cookies so that when the buyer goes to the next page, their info will be pulled from these cookies and stored into the appropriate fields. To set a cookie, follow the format in the image below. The code in the image should be exactly what you need unless you changed the name of your variables (variables are the words with a $ sign in front of it). Note: If you are using this to pre-populate your CartFreak order form DO NOT change any of the variable names. If you didn't add any new variables or kept them as the same name then all you have to do is copy the code in the image below into the php area you have created. Now change the highlighted part in the image above to the order page you are wanting to redirect them to. The cookies full of important information should be setting on the user's computer now. To test this, fill in your form and hit submit. Once you have been redireted to order.php, check your cookies (tools --> options --> show cookies --> look for your site name). Once your cookies are setting properly, you can now assign the fields the correct information. In the image below you should see the php codes needed to pass the data. -- Just enter this in on Dreamweaver in the initial value field when you click the text box. -- If you do not have Dreamweaver and are using something simpler like NotePad, see text under this example. ![]() Pre-Population for editors without a Display view: -- Find the form in the code. -- Then use the same variables as shown in the image above for each corresponding field. -- You will do this by typing in the exact text you see in the image above into "value". -- It should look like this value="<?=$first_name;?>" Do this for each field with correct variables. Save everything and upload it to your site. Everything should be working great! |


