Pre-populate form based on link?
- Started
- Last post
- 4 Responses
- kalkal
I have a bunch of plans on my site but I assume my clients will be booking rather than paying online. To make it easier for them, I'd want them to click a button on a price table based on which plan they'd want.
They'd then be taken to a form which I'd like to be prepopulated with info based on the plan which they have chosen.
What's the best way to pass on that predefined info onto the form from page a -> b?
- ernexbcn0
Via a POST or a GET request. You can link to next page using just a link with a variable (get) or having a form on page 1 and submitting via POST.
- kalkal0
Ok that's brilliant, sending the info via the url. Now is there anywhere I can copy and paste this functionality so I don't have to do any work?
- vaxorcist0
DANGER WILL ROBINSON!!!!
If this link gets into the hands of spammers, who figure out the link variables, they can use you as a spam gateway..... and/or engage in SQL injection attacks.....
make sure there are NO email addresses in the URL sent....
and make sure where you send the email from the form processing is not just a hiddent field, but nowhere in the URL or form, but only visible in the server-side source code (PHP/ASP/etc)
- Or you could just sanitize any server variables...mikotondria3
- Good advice, thankskalkal
- vaxorcist0
safest way would be to pre-populate an excel file, then export it as a .tab-separated file, import it into a database and use a hashkey per row lookup, so each url looks like:
www.yourserver.com/?h=2123asdf34…...
...and that h var points to a field in each row of your table that's an MD5 hash (unique and unguessable)