Abdus Sattar Bhuiyan
Abdus Sattar Bhuiyan

Reputation: 3074

how to wrap variable by single quote instead of double quotes in php

Code:

<input type="text" class="hide" id="z-scharge" value='<?php echo $zero_service_charge; ?>' />

this produces the following output:

<input type="text" class="hide text" id="z-scharge" value="5" style="display: none;">

My expected output is:

<input type="text" class="hide text" id="z-scharge" value='5' style="display: none;">

Is it possible by any trick?

Upvotes: 1

Views: 314

Answers (1)

GolezTrol
GolezTrol

Reputation: 116100

That code will output the attribute value with single quotes.

However, the HTML is parsed by the browser and turned into a document object, which is displayed to the user. In that browser, you can inspect elements, but when you do, you don't get the exact information as it is in the source. The browser can make small alterations based on how it parses it. For instance, it may show all attribute values as double quoted values.

To make sure, choose 'View source' and view the exact and complete source of the response.

Upvotes: 4

Related Questions