<?php
/***
*************************************************************
*** Sample script for class power
*** by José Giambruno josegiambruno@adinet.com.uy
*************************************************************
***/
require_once('power2_class.php');
$n=10; // This is a sample value; you can change it if you wish;;
$x2=intval($n/2);
echo "<table border=1 bordercolor=#394DFD width=100%><tr><td width=70%>";
echo "<b><center>this is a sample with $n items, check one or more and submit</i></b></center>";
echo "<html><body bgcolor=#ACBDB4>";
$max=1;
for ($y=0;$y<$n;$y++){
$max=$max*2;
$maxvalue=$maxvalue+$max;
}
echo "<form name=FormName action=p2_sample.php method=post>";
for ($x=0;$x<$n;$x++){
if ($x==$x2){echo "<br>";}
echo "Item ".$x."-><input name=pepis[$x] type=checkbox value='ON'>";
}
echo "<hr><h3><center> or</h3> <hr>enter a number not greater than $maxvalue to view the original sequence:";
echo "<input type=text name=numero size=6>";
echo "<hr><br><br><br><center>";
echo "<input type=submit value=Send></form>";
echo "</td><td width=30% valign=top> ";
if (isset($numero) or isset($pepis)){
$mypower=new power2();
if ($numero>0 and $numero<=$maxvalue){
$r=0;
$resultado=$mypower->descomponer($numero);
foreach($resultado as $valor){
echo "<br>value of item $r = ".$valor;
$r=$r+1;
}
}else{
$resultado=$mypower->componer($pepis) ;
echo "<font color=#394DFD size=3><b><br><br><br><br>";
echo "sequence code is:<br><br><br><center><font color=#0218E3 size=5>".$resultado;
}
}
echo "</td></tr></table><br><br><table border=0 width=100%><tr>";
echo "<td align=left><a href=p2doc_sp.php>Ver doc. español</a></td>";
echo "<td align=left><a href=p2doc_en.php>View doc. english</a></td><td align=right>By <a href=mailto:josegiambruno@adinet.com.uy>José Giambruno</a></body></html>";
echo "</td></tr></table></body></html>";
?>
|