473,395 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem in converting number and string

119 100+
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
Nov 13 '08 #1
5 1270
sukatoa
539 512MB
Split the value using " "(space) pattern, grab the $value[1].......
Nov 13 '08 #2
phpmagesh
119 100+
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
Nov 13 '08 #3
sukatoa
539 512MB
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
Nov 13 '08 #4
Markus
6,050 Expert 4TB
Please provide the code you have attempted.
Nov 13 '08 #5
phpmagesh
119 100+
Please provide the code you have attempted.
Expand|Select|Wrap|Line Numbers
  1. <!--
  2. <table width="100%" border="0" cellspacing="3" cellpadding="0">
  3. <tr><td class="productDesc" rowspan="8" valign="top" width="300">{if $PRODUCTS_DESCRIPTION !=''}{$PRODUCTS_DESCRIPTION}<br />
  4. <br>{/if}
  5.                                                                          {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 />
  6. <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>
  7. </strong>{/if}<br />
  8. {if $PRODUCTS_IMAGE_LINK!=''}<br />                            <a href="{$PRODUCTS_IMAGE_LINK}" onclick="window.open(this.href); return false;">{$PRODUCTS_TEXT_ZOOM}</a><br />
  9. {/if}<br />
  10. {if $PRODUCTS_FSK18=='true'} <br />                            <img src="{$tpl_path}img/fsk18.gif" alt="" />{/if}<br />
  11. {if $MODULE_graduated_price !=''} {$MODULE_graduated_price}<br />
  12. <br /><br />
  13. {/if}
  14. </td>
  15. <td width="20"></td>
  16. <td class="productInfoPrice" align="center"><b id='productInfoPrice'>{$PRODUCTS_PRICE} </b><br />
  17. <script>
  18. sum1={$PRODUCTS_PRICE_ORG};
  19. </script></td>
  20. </tr>
  21. <tr>
  22. <td width="20"></td>
  23. <td align="center">{$PRODUCTS_DISCOUNT}</td>
  24. </tr>
  25. <tr>
  26. <td width="20"></td>
  27. <td align="center"><div align="center">{if $MODULE_product_options !=''}<strong><font size="2">{#text_options#}<br />
  28. </font></strong><font size="2">{$MODULE_product_options}<br />
  29.  {/if}</font><br />
  30. <br />
  31. </div></td>
  32. </tr>
  33. <tr>
  34. <td width="20"></td>
  35. <td align="center" width=200>
  36. <table border="0" >
  37. <tr>
  38. {$ADD_QTY}                                <td>{$ADD_CART_BUTTON}</td>
  39. </tr>
  40. </table>
  41. </td>
  42. </tr>
  43. </table>
  44.  
  45. -->
This is my actual code. in this i want to get the $PRODUCTS_PRICE value.
Nov 13 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Ali | last post by:
I did the folloing in python shell: >>> x = 5.07e-25 >>> x = long(x) >>> print x 0L Um... I was under the impresion that long numbers had very very long precision. But, it seems that in...
3
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
3
by: Joshua Russell | last post by:
Hi, I've got a program (see source below) that makes a file and fills it with random binary values (from 0 to 255). The source below works, however the program creates files at a rate of about...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
8
by: moondaddy | last post by:
I need to convert a byte array to a string and pass it as a parameter in a URL and then convert it back to the original byte array. However, its getting scrambled in the conversion. In short,...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Alex Buell | last post by:
Is there an elegant way of converting strings containing digits between different number bases in C++? I.e.: 10 (base 2) = 2 (base 10) FF (base 16) = 256 (base 10) F (base 16) = 1111 (base 2)...
3
by: nvx | last post by:
Hi, I'm looking for a simple way to convert a Double to a String exactly the .ToString() does, except these two differences: - the number of decimals is given (rounding is applied if necessary),...
3
by: Marc 'BlackJack' Rintsch | last post by:
On Thu, 28 Aug 2008 09:13:00 -0700, SUBHABRATA wrote: a1, a2, a2, …, a20? You must be kidding. Please stop numbering names and use *meaningful* names instead! Could you describe them...
4
by: HxRLxY | last post by:
I am having a compile-time problem with a simple program I am writing. When I attempt to compile, I get the error "non-static variable this cannot be referenced from a static context". The error...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.