Quantcast
Channel: RaGEZONE - MMO Development Forums
Viewing all articles
Browse latest Browse all 14581

My first codes in php

$
0
0
Insert Text in TextBox:

Click Sumbit to Display what's wrriten:

PHP Code:

<?php
    
require('George.php');
    
$George = new George();

    
/* Output message (popup/normal) */
    
$George->Output("Welcome to George Class"02552556000);    
    
    
    
/* Connect to website by name */
    //$George->ConnectTo("http://www.google.com");
    
    /* Label */
    
$George->Output("Insert Text"2550065120);
    
    
/* Textbox */
    //$George->TextBox("TextBox1", 604, 35);
    
    /* Button */
    
$George->Button("TextBox1""Sumbit"6103665360);
    
$George->Output2($TextBox1);
?>

PHP Code:

<?php
class George
{
    function 
RGBToHex($r$g$b
    {
        if((
$r == "0") && ($g == "0") && ($b == "0")) return '#FFFFFF';
        
$hex "#";
        
$hex.= str_pad(dechex($r), 2"0"STR_PAD_LEFT);
        
$hex.= str_pad(dechex($g), 2"0"STR_PAD_LEFT);
        
$hex.= str_pad(dechex($b), 2"0"STR_PAD_LEFT);
        return 
$hex;
    }
    function 
Output($szText$r$g$b$left$top)
    {
        
$color $this->RGBToHex($r$g$b);
        echo 
"<font color='$color' style='position:absolute; left:$left; top:$top;'>$szText</font>";
    }
    function 
Output2($szText)
    {
        echo 
"<script type='text/javascript'>alert('{$szText}');</script>";
    }
    function 
ConnectTo($szText)
    {
        
header("Location: $szText");
    }
    function 
TextBox($szName$left$top)
    {
        echo
        
"<form method='post' action=''>".
        
"<input type='text' name='{$szName}' id='text' style='position:absolute; left:$left; top:$top;'/>".
        
"</form>";
    }
    function 
Button($szName$szSecondName$left$top$left2$top2)
    {    
        echo
        
"<form method='post'>".
        
"<input type='text' name='{$szName}' id='text' style='position:absolute; left:$left; top:$top;'/>".
        
"<input type='submit' name='Enter' id='Enter' value='{$szSecondName}' style='position:absolute; left:$left2; top:$top2;'/>".
        
"</form>";
    }
}
?>


Viewing all articles
Browse latest Browse all 14581

Trending Articles