PHP Classes

File: examples/forms_test.php

Recommend this page to a friend!
  Classes of Yaroslav Shapoval   Cyrillic to Latin   examples/forms_test.php   Download  
File: examples/forms_test.php
Role: Example script
Content type: text/plain
Description: usage example with forms
Class: Cyrillic to Latin
Translite text between cyrillic and latin
Author: By
Last change:
Date: 19 years ago
Size: 1,164 bytes
 

Contents

Class file image Download
<?php
if (!isset($_POST['convert'])){
    echo
"
<html>
  <head><title>lat2cyr test form</title></head>
    <body>
     <form action=forms_test.php method=POST>
      <textarea name=input rows=10 cols=60>Pro Scheloch'</textarea><br>
      <input name=how type=radio value=0 checked>lat2cyr test<br>
      <input name=how type=radio value=1>cyr2lat test<br>
      <input type=submit name=convert value='GO!'>
     </form>
    </body>
</html>"
;
exit;
}
require_once(
"../cyrlat.class.php");
$cyrlat=new CyrLat;
$input=$_POST['input'];
$how=$_POST['how'];
switch(
$how){
 case
0: $result=$cyrlat->lat2cyr($input);break;
 case
1: $result=$cyrlat->cyr2lat($input);break;
}
echo
"
<html>
  <head><title>latr2cyr test result</title></head>
    <body>
    <h1>Result:</h1>
     <form action=forms_test.php method=POST>
      <textarea rows=10 cols=60 disabled=true>
$result</textarea><br>
    <h1>Try Again?</h1>
       <textarea name=input rows=10 cols=60>
$input</textarea><br>
      <input name=how type=radio value=0 checked>lat2cyr test<br>
      <input name=how type=radio value=1>cyr2lat test<br>
      <input type=submit name=convert value='GO!'>
     </form>
    </body>
</html>"
;
?>