0

I'm trying to create some input forms in PHP dynamically. It's a function which returns the html into the view. (ZF2)

In php I've got this: <input name="bla" type="text" value="bla" />

Its becoming this: <input name="bla" type="text" value="bla" >

So the slash at the end is missing. can someone tell me why?

Thanks in advance.

tereško
  • 58,060
  • 25
  • 98
  • 150
wurmi
  • 333
  • 5
  • 18
  • 2
    If you are looking at source code on browser, it is normal. Relax – Hüseyin BABAL Apr 01 '14 at 18:10
  • How are you viewing the HTML? Are you using developer tools right-click > "Inspect Element" or right-click > "view source"? Viewing the DOM in Developer Tools will hide the "/>", but they should be there in view source. If not, what function are you using to produce the view? – ideonexus Apr 01 '14 at 18:14
  • that's right. the source code is correct. thanks. but i need to find the stylebreaking part somewhere else... – wurmi Apr 01 '14 at 19:40
  • not to mention that `` is as valid as `` when it comes to HTML5 – Sam Apr 01 '14 at 20:16

1 Answers1

0

The input element is a void element: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input There are two ways to write a void element:

<element> or <element /> (but never <element></element>) I don't really know the zend framework, but I guess it defaults to the first, which is the more standard way or writing things. See also question Are (non-void) self-closing tags valid in HTML5?

Community
  • 1
  • 1
Martijn
  • 11,964
  • 12
  • 50
  • 96