-1

I am trying to include a CSS link in hidden input value using PHP. but it not including properly as shown in the image.

enter image description here

Code

<?php 
            $minCss='<link href="'.$bootstrap_js_link.'" rel="stylesheet">';

?>
 <input type="hidden" value="'<?php echo $minCss; ?>'" id="snippet_resource"/>
Upasana Chauhan
  • 948
  • 1
  • 11
  • 32

1 Answers1

3

You need to escape HTML entities to include your value into the attribute. You may use htmlspecialchars:

<input type="hidden" value="<?= htmlspecialchars($minCss) ?>" id="snippet_resource" />
Jeto
  • 14,596
  • 2
  • 32
  • 46
  • thanks, it worked for me... someone voted this negative... is it silly question? – Upasana Chauhan Apr 17 '19 at 14:49
  • @UpasanaChauhan I think it was unclear why you were doing what you were doing. It probably seemed a rather unusual thing to do, sending that string as a form input. I can't say for sure, because I was not the downvoter. – TecBrat Apr 17 '19 at 15:07