0

hello , i want to make like this . _

$m = $_GET["uion"];
class NewGo

{

public $username = '$m';
public $password = '1131';

 
}

but its not working . plz anyone tell me the exact correct code

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

HERE is exact code

<form method="get" action="login.php">
<div>
<input type="hidden" name="send" value="yes" />
<input type="hidden" name="act" value="login" />
Nickname*:<br/>
<input type="text" name="loguid" value="" maxlength="50" /><br/>
Password*:<br/>
<input type="password" name="logpwd" value="" maxlength="50" /><br/>
<input type="submit" value="Login" />
</div>
</form>


$uid = $_GET["loguid"];
$pwd = $_GET["logpwd"];


class NewGo
{

public $username = '$uid';
public $password = '$pwd';

 
}
0

that class NewGo is not working properly. i mean class showing $username = NULL

0

You can not use class in this way.
you have to create object of class and then have to assign class member values.

class NewGo
{
	public $username;
	public $password; 
}

$obj = new NewGo();
$obj->username = $uid;
$obj->password = $pwd;
0

Class and Object Sample:

<?php 
class Bear { 
    public $name; 
    public $weight; 
    public $age; 
    public $colour; 
     
    public function __construct() { 
        $this->age = 0; 
        $this->weight = 100; 
        $this->colour = "brown"; 
    } 
     
    // define methods 
} 

?>
<?php 

// create instance 
$baby = new Bear; 
$baby->name = "Baby Bear"; 
echo $baby->name." is ".$baby->colour." and weighs ".$baby->weight." units at birth"; 

?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.