Well, i want to call a function like alert() (javascript) into the class construct PHP, when the POST variable is no define. but i don't no if it's posible.
class Su{
private $nomb;
private $dir;
private $tel;
public function __CONSTRUCT($mode){
try {
if(isset($_POST['nomb'])) {
?>
<script language="javascript">alert("Sorry, this field can't be empty ")</script>
<?php
throw new Exception('?view=sucursal&mode=' . $mode . '&error=define');
}
} catch(Exception $error) {
header('location: '.$error->getMessage());
exit;
}
$this->nomb = strtoupper($_POST['nomb']);
$this->dir = strtoupper($_POST['dir']);
$this->tel = strtoupper($_POST['tel']);
}
public function __GET($var){ return $this->$var; }
public function __SET($var, $valor){ return $this->$var = $valor; }
}