Tuesday, 15 January 2013

php - Function within str_replace not working correctly -


Please see your code below, I am trying to keep a statement in a Staveover statement, however, this injection It is in the script, thanks in advance for your help, in fact, I need to change the [value] in the string with its price if statement.

  function value () {if ($ _SESSION ['VAT'] == "ex") {echo ('& amp; pound;' $ row_products ['value']. ​​' VAT '); }? & Gt; & Lt ;? Php if ($ _SESSION ['VAT'] == "inc") {$ total_price = $ row_products ['value'] * = (1 + $ VATrate / 100); Echo ('& amp; pound;'); Printf ("% .2f", $ total_price); Echo ('Inc. VAT'); }} $ Main_description = str_replace ('[value]', value (), $ row_products ['description']);    

Not tested, but it should do anything on its lines: < / P>

  function value () {if ($ _SESSION ['VAT'] == "ex") {Return 'and pound;' $ Row_products ['price'] Ex VAT '; } If ($ _SESSION ['VAT'] == "inc") {$ total_price = $ row_products ['value'] * = (1 + $ VAT / 100); Return sprint ("% s% .2f% s", "and pounds;", $ total_price, 'VAT ink'); }}    

No comments:

Post a Comment