Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Shehan Guruge
Shehan Guruge
6,828 Points

store a java script variable in database using php

Hi There,

I am trying to store a javascript variable using php into a mysql database. I have been able to store into the database previously but in those occasions I have used the name property for the respective <input> in this case some of the data that I intend to record are not in <input> tags rather they are images, some of them which are in <input> tags are required to be concatenated and then only inserted into the database.

I would like to do this using prepend for inserting into the database rather than concatenating as from what I have gathered with concatenate it could be open to sql injection.

Thanks in Advance