PHP Classes

File: select_display.php

Recommend this page to a friend!
  Classes of Stephane Mouton   Currency Display & Convert   select_display.php   Download  
File: select_display.php
Role: ???
Content type: text/plain
Description: An example to help you interactively select parameters for the Currency Display class
Class: Currency Display & Convert
Currency conversion and display with locale format
Author: By
Last change:
Date: 23 years ago
Size: 6,751 bytes
 

Contents

Class file image Download
<html> <head> <title>Currency Display class Selector</title> </head> <body> <H1>Currency Display class Selector</h1> The goal of this tool is to help you use the CurrencyDisplay class by selecting class parameters using a web form.<br> Once you've selected your parameters, you obtain the PHP code to insert in your page as well as a sample of the display format <? if (isset($show)){ include('class_currency_display.php'); $display=new CurrencyDisplay($id,$symbol,$nbdecimal,$sdecimal,$thousands,$positive,$negative); echo '<H2>Result :</h2>'; echo '<ul><li>Value : '; echo $display->getFullValue($value); echo '</ul>'; echo '<ul><li>PHP code : <pre>'; echo "object = new CurrencyDisplay('$id', '$symbol', $nbdecimal, '$sdecimal', '$thousands', $positive, $negative);"; echo '</pre></ul>'; } ?> <H2>Enter your choice :</h2> <form action="<? echo $PHP_SELF; ?>" method="POST"> <table cellspacing="2" cellpadding="2" border="0"> <tr> <!-- ================================ --> <td align="right">Value : </td> <? if (isset($show)): ?> <td><input type="Text" name="value" value="<? echo $value; ?>"></td> <? else : ?> <td><input type="Text" name="value" ></td> <? endif; ?> <td>Sample value to display</td> </tr> <tr> <!-- ================================ --> <td align="right">ID : </td> <? if (isset($show)): ?> <td><input type="Text" name="id" value="<? echo $id; ?>" size="10"></td> <? else : ?> <td><input type="Text" name="id" value="euro" size="10"></td> <? endif; ?> <td>Your own, non displayed, currency IDentifier (ex: use with a DB)</td> </tr> <tr> <!-- ================================ --> <td align="right">Currency symbol : </td> <? if (isset($show)): ?> <td><input type="Text" name="symbol" value="<? echo $symbol; ?>" size="4"></td> <? else : ?> <td><input type="Text" name="symbol" value="Euro" size="4"></td> <? endif; ?> <td>Displayed currency symbol (ex : $, FF, DM)</td> </tr> <tr> <!-- ================================ --> <td align="right">Decimals : </td> <? if (isset($show)): ?> <td><input type="Text" name="nbdecimal" value="<? echo $nbdecimal; ?>" size="1"></td> <? else : ?> <td><input type="Text" name="nbdecimal" value="2" size="1"></td> <? endif; ?> <td>Number of displayed decimals (can be 0)<br><b>Performs rounding if value has different number of decimals</b></td> </tr> <tr> <!-- ================================ --> <td align="right">Decimal symbol : </td> <? if (isset($show)): ?> <td><input type="Text" name="sdecimal" value="<? echo $sdecimal; ?>" size="1"></td> <? else : ?> <td><input type="Text" name="sdecimal" value="." size="1"></td> <? endif; ?> <td>Character used as decimal symbol</b></td> </tr> <tr> <!-- ================================ --> <td align="right">Thousands separator : </td> <? if (isset($show)): ?> <td><input type="Text" name="thousands" value="<? echo $thousands; ?>" size="1"></td> <? else : ?> <td><input type="Text" name="thousands" size="1"></td> <? endif; ?> <td>Character used to separate thousands (can be nothing : '')</td> </tr> <tr> <!-- ================================ --> <td align="right">Positive format : </td> <td> <? if (isset($show)): ?> <select name="positive"> <option value="0"<? if ($positive=='0') echo ' selected ';?>>00Symb</option> <option value="1"<? if ($positive=='1') echo ' selected ';?>>00 Symb</option> <option value="2"<? if ($positive=='2') echo ' selected ';?>>Symb00</option> <option value="3"<? if ($positive=='3') echo ' selected ';?>>Symb 00</option> </select> <? else : ?> <select name="positive"> <option value="0">00Symb</option> <option value="1" selected>00 Symb</option> <option value="2">Symb00</option> <option value="3">Symb 00</option> </select> <? endif; ?> </td> <td>Display format used to display positive values.<br>(Symb stands for currency symbol)</td> </tr> <tr> <!-- ================================ --> <td align="right">Negative format : </td> <td> <? if (isset($show)): ?> <select name="negative"> <option value="0"<? if ($negative=='0') echo ' selected ';?>>(Symb00)</option> <option value="1"<? if ($negative=='1') echo ' selected ';?>>-Symb00</option> <option value="2"<? if ($negative=='2') echo ' selected ';?>>Symb-00</option> <option value="3"<? if ($negative=='3') echo ' selected ';?>>Symb00-</option> <option value="4"<? if ($negative=='4') echo ' selected ';?>>(00Symb)</option> <option value="5"<? if ($negative=='5') echo ' selected ';?>>-00Symb</option> <option value="6"<? if ($negative=='6') echo ' selected ';?>>00-Symb</option> <option value="7"<? if ($negative=='7') echo ' selected ';?>>00Symb-</option> <option value="8"<? if ($negative=='8') echo ' selected ';?>>-00 Symb</option> <option value="9"<? if ($negative=='9') echo ' selected ';?>>-Symb 00</option> <option value="10"<? if ($negative=='10') echo ' selected ';?>>00 Symb-</option> <option value="11"<? if ($negative=='11') echo ' selected ';?>>Symb 00-</option> <option value="12"<? if ($negative=='12') echo ' selected ';?>>Symb -00</option> <option value="13"<? if ($negative=='13') echo ' selected ';?>>00- Symb</option> <option value="14"<? if ($negative=='14') echo ' selected ';?>>(Symb 00)</option> <option value="15"<? if ($negative=='15') echo ' selected ';?>>(00 Symb)</option> </select> <? else : ?> <select name="negative"> <option value="0">(Symb00)</option> <option value="1">-Symb00</option> <option value="2">Symb-00</option> <option value="3">Symb00-</option> <option value="4">(00Symb)</option> <option value="5">-00Symb</option> <option value="6">00-Symb</option> <option value="7">00Symb-</option> <option value="8" selected>-00 Symb</option> <option value="9">-Symb 00</option> <option value="10">00 Symb-</option> <option value="11">Symb 00-</option> <option value="12">Symb -00</option> <option value="13">00- Symb</option> <option value="14">(Symb 00)</option> <option value="15">(00 Symb)</option> </select> <? endif; ?> </td> <td>Display format used to display negative values.<br>(Symb stands for currency symbol)</td> </tr> <tr> <td align="right"></td> <td align="right"><input type="Submit" name="show" value="Show"></td> <td></td> </tr> </table> </form> </body> </html>