View Full Version : Form Field
07-21-2011, 10:14 AM
I dont know whether this is possible. I am looking to hide some information in a form text field. Is there anyway of doing this?
07-21-2011, 11:59 AM
I am looking to hide some information in a form text field.
What's your ultimate behind this?
07-21-2011, 12:01 PM
I have 200 products and each has the same form and php... When the user hits "submit" I need to somehow know what product page it has come from.
07-21-2011, 12:14 PM
Assuming that it's just that you don't want the field's contents visible, could you just store it in a hidden field?
<input name="fieldname" id="fieldname" type="hidden" value="variable that you're storing" />
You can then read the contents of the field and insert or update the relevant column when the form's sent.
07-21-2011, 02:24 PM
Awesome Idea... Thanks!
07-22-2011, 10:48 AM
Is there any way to have the URL in the hidden field without writing the URL out each time?
07-22-2011, 12:03 PM
If you're using PHP, you can use
to set a variable on the referring page, which you can then pass on.
However, you might not need to save the whole path anyway. Assuming that your referring page path is something like "/folder/foo.php", that the page your linking to is "/folder/bar.php", and that your products are all saved with an ID number in your database, the referring page could be passing over "/folder/bar.php?productID=50". The only unique bit of information in that string is "50", so it makes more sense to just store that - it'll still tell you the product that they've been looking at.
So, if that's the case, you could just add the ID number of the product from your database as a querystring to the link (or save it to a hidden field and post the contents of the form if you want the contents to be less obvious), from your referring page, and then get the data of which page it's come from that way.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.