I have an autosuggest done in PHP which on selection will provide to me the id of the item selected from the auto suggest. I would like to post the id that was selected to the server. What would be the best practice to store this variable and sent the same to the server via HTTP Post in PHP?
Steps:
- List data from a Auto Suggest Text Box. (This is done using javascript).
- Select an Item from the Auto Suggest and also store the key value for the selection in a data store that can be sent over HTTP Post. (The data store is what I am not able to understand)
- Post the form to the server.
I tried to store the value into a hidden field and my javascript breaks, not sure why. Is there any other data store mechanism that I can use other than hidden fields?
Could someone please guide me through this as I am pretty new to PHP.
Thanks and Regards
Abishek R Srikaanth
Your javascript may be breaking due to unescaped ‘ or some other parsing error. Check your browser’s javascript console (firefox and chrome have it) for the error.
Hidden field is the way to go. So instead of using other method, try to fix the JS code.