PHP Classes

File: exemple.php

Recommend this page to a friend!
  Classes of Manel Zaera   Calculadora Escons   exemple.php   Download  
File: exemple.php
Role: Example script
Content type: text/plain
Description: Sample file
Class: Calculadora Escons
Calculate elected seats using D'Hondt method
Author: By
Last change: Sample file.
Date: 16 years ago
Size: 2,660 bytes
 

Contents

Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>C&agrave;lcul d'escons</title>
<style>
body {font-family: verdana}
table {border-style: 1pt;}
thead {border-style: 1pt;}
th {background-color: #d52d25;color:white;font-style:bold;border-style: 1pt;}
</style>
</head>
<body>
<?
require_once('CalculadoraEscons.php');
$iRegidors = 17;
$aCalc = new CalculadoraEscons();
$aVots = array('CiU' => $_POST['ciu'],'PSC' => $_POST['psc'],'ERC' => $_POST['erc'],'ICV' => $_POST['icv'],'PP' => $_POST['pp'],'PACMA' => $_POST['pacma'],'PxC' => $_POST['pxc']);
$aRegidorsPartits = $aCalc->calcula($aVots,$iRegidors);
?>
<form name="partits" id="partits" method="POST" action="exemple.php">
<br/>
<fieldset id="grupvots"><legend>Vots</legend><fliedset id="vots">
<label for="ciu">CiU</label>
  <input type="text" id="ciu" name="ciu" value="<?=$_POST['ciu']?>" size="5" maxlength="5"/>
<label for="psc">PSC</label>
  <input type="text" id="psc" name="psc" value="<?=$_POST['psc']?>" size="5" maxlength="5"/>
<label for="erc">ERC</label>
  <input type="text" id="erc" name="erc" value="<?=$_POST['erc']?>" size="5" maxlength="5"/>
<label for="icv">ICV</label>
  <input type="text" id="icv" name="icv" value="<?=$_POST['icv']?>" size="5" maxlength="5"/>
<label for="pp">PP</label>
  <input type="text" id="pp" name="pp" value="<?=$_POST['pp']?>" size="5" maxlength="5"/>
<label for="pacma">PACMA</label>
  <input type="text" id="pacma" name="pacma" value="<?=$_POST['pacma']?>" size="5" maxlength="5"/>
<label for="pxc">PxC</label>
  <input type="text" id="pxc" name="pxc" value="<?=$_POST['pxc']?>" size="5" maxlength="5"/>

</fieldset></fieldset>
<?
if (count($_POST)>0) { ?>
<fieldset id="grupescons"><legend>Regidors</legend><fieldset id="escons">
<label for="rciu">CiU</label>
 <div id="rciu"><?=$aRegidorsPartits['CiU']?></div>
<label for="rpsc">PSC</label>
 <div id="rciu"><?=$aRegidorsPartits['PSC']?></div>
<label for="rerc">ERC</label>
 <div id="rciu"><?=$aRegidorsPartits['ERC']?></div>
<label for="ricv">ICV</label>
 <div id="rciu"><?=$aRegidorsPartits['ICV']?></div>
<label for="rpp">PP</label>
 <div id="rciu"><?=$aRegidorsPartits['PP']?></div>
<label for="rpacma">PACMA</label>
 <div id="rciu"><?=$aRegidorsPartits['PACMA']?></div>
<label for="rpxc">PxC</label>
 <div id="rciu"><?=$aRegidorsPartits['PxC']?></div>
</fieldset></fieldset>
<?
}
?>
<input type="submit" name="calcula" value="Calcula" />
</form>
</body>