user variable

user variable

by Herman van Keulen -
Number of replies: 4

Hi,

I made a link to a form with name,adress,.....
I would like to put the name of the moodle user automatically into the name field. I set this field into the disabled position so that the user can't edit this.
What's the name of the variable of the user and is it possible to give this to an extern form?

gr.

Herman

Average of ratings: -
In reply to Herman van Keulen

Re: user variable

by Przemyslaw Stencel -
Add a resource of the "link to a file or website" type. As the location, give the url of your form. At the bottom of the resource editing screen, show the settings for "Parameters". In the two columns, the one on the left (Parameter) is the variable in Moodle, the one on the right (Variable name) is the name of the matching variable in your form.

Hope this helps,
Przemek
In reply to Przemyslaw Stencel

Re: user variable

by Herman van Keulen -

Thanks four your answer. But it doesn't work
This is a part of the code and my syntax of the form:

....
<td><input name="achternaam" type="text" value="<?Achternaam>?>" disabled></td>
.....

Achternaam is the name of the user in the left column of parameters and achternaam is the variable name

What's wrong?

In reply to Herman van Keulen

Re: user variable

by Przemyslaw Stencel -
Try like this:

In your course, create a resource, with the following location: http://stencel.info/files/variable.php

Select "New window"

In the parameters table, as the first parameter, select "Full Name", in the matching "variable name", type "user_full_name" (without the quotes).

Then save the resource and try.

Here's the code that I put in that page:

<input type="text" name="full name" value="<?php echo $user_full_name; ?>" disabled />
In reply to Przemyslaw Stencel

Re: user variable

by Herman van Keulen -

Hi,

This works perfectly
I made this in my form: I see in the adress of IE the correct name but in the name field of my form I see : <br /><b>Notice</b>:  Undefined ....

The next line I have adapted: left parameter: Achternaam an the variable called: user_full_name.

<input type="text" name="Achternaam" value="<?php echo $user_full_name; ?>" disabled />

What's the problem ? smile