Default value when add row.

QuestionsDefault value when add row.
Jorge Barosa asked 8 years ago

I'm trying to add default value of the user when saving the form with no sucess !!

The query:
mysql_select_db ( $database_ggi, $ggi );
$query_rsUserName = sprintf ( "SELECT nome FROM utilizadores WHERE utilizador = '%s'", $_SESSION['MM_Username'] );
$rsUserName = mysql_query ( $query_rsUserName, $ggi ) or die ( mysql_error () );
$row_rsUserName = mysql_fetch_assoc ( $rsUserName );
$totalRows_rsUserName = mysql_num_rows ( $rsUserName );

$nome = $row_rsUserName['nome'];

$e["on_insert"] = array("add_client", null, true);
$grid->set_events($e);

function add_client(&$data)
{
$data["params"]["Utilizador"] = $nome;
}

Can somewone help me!

Best regards,
Jorge Barosa

1 Answers
Abu Ghufran answered 8 years ago

You need to define it as global.

function add_client(&$data)
{
global $nome;
$data["params"]["Utilizador"] = $nome;
}

Your Answer

13 + 9 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?