I have the following HTML…
<img id="image1" src="URL" alt="image1" name="image1" width="137" height="119" border="0" style="position: relative; left: -355px; top: 62px;" >
How would I go about storing the following information into a variable..from the style attribute.
$variable1 = -355;
$variable2 = 62;
Thank you in advance!
UPDATE:
Apologies for not explaining clearly and thank you for your help.
The goal right now, after submitting a form on the page, to find all the img tags and store each attribute within the img tag into a PHP variables.
I will then want to store those values into a MySQL database and retrieve them on a different page.
I hope that clears things up.
If you create the page then you should be able to know these values in advance because you can either assign the variables first and then print them in these tags, or, they are already preset somewhere in the template and you are just going to read these values.
Otherwise, if that content is generated in another way, not by your system, then you will need some JavaScript code to ‘read’ these attributes and send it to you ‘aside’ as user submits the form. Usually this is done by adding some hidden fields with the something like “document.image1.src” as the value to be sent.
It is impossible for me to give you even a snipped of code here as we have no idea what really is your application structured like. However, this should give you the understanding on how this works.