I’m putting together a caption system for my site. When the user is finished with their caption and would like to submit, I need a way to insert the width, height, and position (left and right attributes) into my database.
I know I can detect element attributes using JavaScript, but this won’t help me as inserting into the database is done using PHP. How can I detect these attributes in PHP and store them as variables to input into my database?
Any help would be appreciate. Let me know if you want any additional info. Thanks!
You can have an
onsubmit()handler in your form, in which you can get all the required attributes using javascript and inject into hidden fields.Now when form is submitted, you can access these values on server side using PHP.