Sending values by URL

Sending values by URL

by Vitor Gonçalves -
Number of replies: 4

Hi!

In the previous versions of the Moodle 1.6 the code below work fine:

 echo "<input type='button' name='Generate' value='$generate' 
 onclick='javascript:openWindow(&quot;teste.php?lo=$mymodule->id&amp;cid=$course->id&aquot;)' />;"; 

When i click in the button the link is correct:
http://localhost/moodle/mod/mymodule/teste.php?loid=1&cid=2

But with moodle 1.6, the values of variables $mymodule->id and $course->id do not pass by the URL for teste.php file.

I don't undertand why only in 1.6 version this code don't work... Someone can help me? please...

Average of ratings: -
In reply to Vitor Gonçalves

Re: Sending values by URL

by Vitor Gonçalves -

Hi!

First of all, I'm sorry my last question… I forgot read the Security issues in the coding guidelines ( http://docs.moodle.org/en/Coding#Security_issues_.28and_handling_form_and_URL_data.29 )

or forums like

http://moodle.org/mod/forum/discuss.php?d=51864#237169
Re: How to ask parameters from user in import questions module by Jan Dierckx - Thursday, 17 August 2006, 17:05

or

http://moodle.org/mod/forum/discuss.php?d=44620#204732
General developer forum -> Cause of "Course module is incorrect" error in 1.6 -> Re: Cause of "Course module is incorrect" error in 1.6 by Martin Dougiamas - Thursday, 27 April 2006, 14:07

:-|

So, I think the solution is adding the following code in my teste.php file:

$cid = optional_param('cid', 0, PARAM_INT); // Course Module ID
$loid = optional_param('loid', 0, PARAM_INT); // My Module ID

Only with this, I guess it is working fine… But, I’m not sure if it’s the best way…

Any help is greatly appreciated.

In reply to Vitor Gonçalves

Re: Sending values by URL

by Anna natureday.com -

Re: Cause of "Course module is incorrect" error.

Does this always happen?

Annasmile

In reply to Anna natureday.com

Re: Sending values by URL

by Jose A. Heredia -
Nose donde has entrado pero yo he mirado en el vinculo que puse y esta operativo prueba tu si quieres es aqui http://recursos.es.tt y una vez alli en el apartado de entrada a los contenidos en el boton central, encontraras las entradas a los diferentes videotutoriales, previo pago de un sms, y debes tener las cookies habilitadas, entrando en herramientas/opciones de internet/seguridad/, en el formulario de sepomo que aparece para obtener la clave te lo explica perfectamente como habilitarlas
In reply to Anna natureday.com

Re: Sending values by URL

by Vitor Gonçalves -

I think the question (Does this always happen?) is for me smile

No... this only happens in 1.6 version, because the feature was disabled by default in 1.6.x (I guess)...