tags - PHP XHTML self closing input not working -


i must page in xhtml1.0 strict. try hours input tag <input type="text" />. in developer console of firefox & chrome kicks out slash. index.php-file:

<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <head>     <meta charset="utf-8">     <title></title>     <link rel="stylesheet" media="screen" href="css/default.css"> </head> <body> <? include "form.php"; ?> </body> </html> 

the relevant php-code (this last , simpelst test, because i'll start thinking going mad!!):

$inputtagstart = htmlspecialchars_decode('&lt;input name="test" value="andso" /&gt;'); 

output in chrome (same in ff)

<input name="test" value="andso"> 

..and other versions...

$inputtagstart = htmlspecialchars_decode("<label for='".$data['label']."'>".$data['label']."</label><input type='text' name='".$data['label']."' value='".returnpostedtextdata($data['label'], $data['default'])."' ".$classrequired." />", ent_xhtml); 

output in chrome input tag not created

$inputtagstart = htmlspecialchars_decode("&lt;label for='dsf'&gt;df&lt;/label&gt;&lt;input type='text' name='dsf' value='s'/&gt;"); 

output in chrome

<input type="text" name="dsf" value="s"> 

please help, don't it

a browser's developer console not show actual source of page (use "view source" that): shows browser's interpretation of page content, modified javascript (it'll show browser's best guess fix invalid html).

if you're outputting xhtml without xhtml headers, browsers interpret weird html, interpret accordingly, , show interpretation in developer consoles.

  • if want see actual xhtml source of page, use "view source" option.
  • if want see xhtml in developer console, ensure you're outputting header content-type: application/xhtml+xml.

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -