Problem in converting number and string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phpmagesh
    New Member
    • Nov 2008
    • 119

    Problem in converting number and string

    Hai to all,

    I have a variable like $price, in that "From 71.00 CHF" this value will be stored.

    i have few more options to modify that $price value using radio buttons.

    at that time when i click in next radio button the value have to change as "From 81.00 CHF"

    what can i do to do this, i tried but no positive output since some strings are there in that $price.

    how can i overcome this problem.

    Can any one help me please,

    thanks in Advance
  • sukatoa
    Contributor
    • Nov 2007
    • 539

    #2
    Split the value using " "(space) pattern, grab the $value[1].......

    Comment

    • phpmagesh
      New Member
      • Nov 2008
      • 119

      #3
      Originally posted by sukatoa
      Split the value using " "(space) pattern, grab the $value[1].......
      hai

      I m new to PHP, can you tell me cleary how to split that variable, main thing is i want to get the result with decimal value..

      thanks in advance

      Comment

      • sukatoa
        Contributor
        • Nov 2007
        • 539

        #4
        Read the PHP split function and
        try to observe when you split the given data, print all of its elements....

        The same way when capturing XX from XX.YY

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          Please provide the code you have attempted.

          Comment

          • phpmagesh
            New Member
            • Nov 2008
            • 119

            #6
            Originally posted by Markus
            Please provide the code you have attempted.
            Code:
            <!--
            <table width="100%" border="0" cellspacing="3" cellpadding="0">
            <tr><td class="productDesc" rowspan="8" valign="top" width="300">{if $PRODUCTS_DESCRIPTION !=''}{$PRODUCTS_DESCRIPTION}<br />
            <br>{/if}
            						 												{if $PRODUCTS_IMAGE!=''}<a href="{$PRODUCTS_POPUP_LINK}"><img src="{$PRODUCTS_IMAGE}" alt="{$PRODUCTS_NAME}" /></a>{else}<img src="{$tpl_path}img/kein-bild.gif" alt="Leider kein Bild..." />{/if}<br />
            <a href="{$PRODUCTS_POPUP_LINK}"><br />					{#text_image_zoom#}</a><br /> <br />{if $PRODUCTS_IMAGE_1!=''}<strong>{#more_images#}<br /><br />								</strong><a href="{$PRODUCTS_POPUP_LINK}"><img src="{$tpl_path}buttons/{$language}/button_view.gif" alt="Bilder anzeigen" border="0" /></a><strong>
            </strong>{/if}<br />
            {if $PRODUCTS_IMAGE_LINK!=''}<br />							<a href="{$PRODUCTS_IMAGE_LINK}" onclick="window.open(this.href); return false;">{$PRODUCTS_TEXT_ZOOM}</a><br />
            {/if}<br />
            {if $PRODUCTS_FSK18=='true'} <br />							<img src="{$tpl_path}img/fsk18.gif" alt="" />{/if}<br />
            {if $MODULE_graduated_price !=''} {$MODULE_graduated_price}<br />
            <br /><br />
            {/if}
            </td>
            <td width="20"></td>
            <td class="productInfoPrice" align="center"><b id='productInfoPrice'>[B]{$PRODUCTS_PRICE}[/B] </b><br />
            <script>
            sum1={$PRODUCTS_PRICE_ORG};
            </script></td>
            </tr>
            <tr>
            <td width="20"></td>
            <td align="center">{$PRODUCTS_DISCOUNT}</td>
            </tr>
            <tr>
            <td width="20"></td>
            <td align="center"><div align="center">{if $MODULE_product_options !=''}<strong><font size="2">{#text_options#}<br />
            </font></strong><font size="2">{$MODULE_product_options}<br />
             {/if}</font><br />
            <br />
            </div></td>
            </tr>
            <tr>
            <td width="20"></td>
            <td align="center" width=200>
            <table border="0" >
            <tr>
            {$ADD_QTY}								<td>{$ADD_CART_BUTTON}</td>
            </tr>
            </table>
            </td>
            </tr>
            </table>
            
            -->
            This is my actual code. in this i want to get the $PRODUCTS_PRICE value.

            Comment

            Working...