-3

The body of an HTML has a specific style for background. When running PHP that style is not transferred. Can the responding PHP obtain that style?

<body style="background-color: silver; font-family: Ariel, Helvetica, san-serif;">

There is no external CSS. This is a class assignment and I'm wondering if this is possible. I have asked the professor with no answer on it. Now I have turned to you guys. If you need more code information

This should be the result:

enter image description here

Cr4sh0ver
  • 35
  • 1
  • 3
  • 2
    What do you mean when you say "When running PHP that style is not transferred."? – BoltClock May 03 '13 at 17:28
  • what code transfer are you refering to ? – karthikr May 03 '13 at 17:28
  • 2
    Please don't post images showing the code. Someone may need to copy & paste your code for some reason. – Lion May 03 '13 at 17:28
  • when the submit button is clicked in the HTML page the PHP code is processed. Loads results, except for the background. – Cr4sh0ver May 03 '13 at 17:31
  • You can try using javascript. http://stackoverflow.com/questions/1887104/how-to-get-the-background-color-of-an-element-using-javascript – Willy Pt May 03 '13 at 17:31
  • 1
    I think the scenario is an html page (with an inline body style) contains a form; the response page is written in php, and s/he'd like the response to have the same body style as the html. How about you just use php to generate the form in the first place? Then you can put the same style in both. – Nate Hekman May 03 '13 at 17:32
  • Nate you are right on the money. How would I go about using style in PHP. This is a simple assignment I just want to know if its possible and how can it be done in case I run into something like this later on. – Cr4sh0ver May 03 '13 at 17:36

1 Answers1

0

If the style attribute is static, you could just copy and paste it into your PHP document.

If not and you can modify HTML document, add some javascript to either submit the form using AJAX and pass the document.body.style attribute to the server with it or put the document.body.style attribute in a tag in the form.

If you can't modify the HTML and the style attribute isn't static, such as the situation where the HTML document is another website, you could CURL it into the PHP document and pull out the attribute with a regular expression.

Dylan Karr
  • 3,304
  • 4
  • 19
  • 29
  • HTML is to remain intact. PHP is the only solution, I can make any changes there. What could be some examples I could use? – Cr4sh0ver May 03 '13 at 17:38