<?php
/* PLEASE DO NOT EDIT UNLESS YOU HAVE KNOWLEDGE OF PHP CODING */
/* DOING SO COULD CAUSE THE SCRIPT TO FAIL */
/* Create the opening tag for your form */
function open_form($method,$action,$name){
$html = '<form method="'.$method.'" action="'.$action.'" name="'.$name.'">';
return $html;
}
/* Create the input box for the form */
function create_text_input($name,$size,$value,$style){
if(!$size){
$input_size = "20";
}
else{
$input_size = $size;
}
$html = '<input type="text" name="'.$name.'" size="'.$input_size.'" value="'.$value.'" '.$style.' />';
return $html;
}
/* Create the dropdown for the form */
function create_dropdown($name,$option_values,$option_texts,$style){
if($option_values == ""){
return false;
}
elseif($option_texts == ""){
return false;
}
else{
$Values = explode("|", $option_values);
$Values_count = count($Values)-1;
$Texts = explode("|", $option_texts);
$Texts_count = count($Texts)-1;
if($Values_count != $Texts_count){
return false;
}
else{
if($name == ""){
$name = "dropdown_box";
}
$html = '<select name="'.$name.'" '.$style.' >';
for ( $n = 0; $n <= $Values_count; $n += 1) {
$html .= '<option value="'.$Values[$n].'">'.$Texts[$n].'</option>';
}
$html .= '</select>';
return $html;
}
}
}
/* Error / Result Message */
function generate_message($type,$style,$message,$first_num,$second_num,$third_num,$result){
if($type == "error"){
$html = '<span '.$style.'>'.$message.'</span>';
}
elseif($type == "result"){
$message_content = str_replace("{NUM1}", $first_num, $message);
$message_content = str_replace("{NUM2}", $second_num, $message_content);
$message_content = str_replace("{NUM3}", $third_num, $message_content);
$message_content = str_replace("{RESULT}", $result, $message_content);
$html = '<span '.$style.'>'.$message_content.'</span>';
}
else{
$html = "";
}
return $html;
}
/* Square Number */
function square( $number ){
$newNumber = $number * $number;
return $newNumber;
}
/* Cube Number */
function cube( $number ){
$newNumber = $number * $number * $number;
return $newNumber;
}
?>