Hi there!
i am quite new to CMSMS and we are developing some stuff for future use by our customers.
For the moment I am stuck with reading the data from an frontend form.
I am using:
MySQL: 5.0.60
PHP: PHP Version 5.2.6-pl6-gentoo
The problem is that not all the values in the form shows up in the $params variable.
The code for the form looks like:
echo ''.'Ändra din prenumeration'.'
';
echo 'E-post: ' . $user['email'] . '
';
echo 'Namn: ' . $user['username'] . '';
echo $this -> CreateFrontendFormStart($id, $params['returnid'], 'pdi_usersettings', 'post', '', true);
echo $this -> CreateInputHidden($id, 'uniqueid', $params['uniqueid']);
echo $this -> CreateInputHidden($id, 'myfunc', 'change');
foreach($lists as $key => $value)
{
$checked = isset($listuser[$key]);
echo '' . $this -> CreateInputCheckbox($id, 'list['.$key.']', $value['listid'], '', $checked ? 'checked="checked"' : '') .
' ' . $lists[$key]['name'] . ' - ' . $lists[$key]['description'] . '';
}
echo '' . $this -> CreateInputSubmit($id, 'change', 'Ändra prenumerationer') . $this -> CreateFormEnd() . '';
The $_POST looks like:
Array
(
[mact] => NMS,m6,pdi_usersettings,1
[m6returnid] => 61
[page] => 61
[m6uniqueid] => 3701da26f0105d8052e7a1f59f4f0f6e
[m6myfunc] => change
[m6list] => Array
(
[1] => 1
[2] => 2
)
[m6change] => Ändra prenumerationer
)
The $params looks like:
Array
(
[action] => pdi_default
[mode] => subscribe
[select] => Militanta köttätare
[module] => NMS
[returnid] => 61
[uniqueid] => 3701da26f0105d8052e7a1f59f4f0f6e
)
Anybody has a clue?
Problems getting frontend form data into params variable
Re: Problems getting frontend form data into params variable
Could you also post the HTML output of your script?
The two arrays you've posted seem to be created by different actions.
The two arrays you've posted seem to be created by different actions.
Re: Problems getting frontend form data into params variable
The HTML output looks like this from URL: http://kp.jon.phosdev.se/index.php?mact ... 61&page=61
When clicking the form the page looks like this: (from this url)
http://kp.jon.phosdev.se/index.php
Maybe it's me not fully unjderstanding the internal working for links and forms of CMSMS.
If that's the case could someone give me a hint or a resource on the topic?
thnx
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Kristoffers test - Prenumerantsida</title>
<base href="http://kp.jon.phosdev.se/" />
<meta name="Generator" content="CMS Made Simple - Copyright (C) 2004-6 Ted Kulp. All rights reserved." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="print" href="http://kp.jon.phosdev.se/stylesheet.php?cssid=30&mediatype=print" />
<link rel="stylesheet" type="text/css" media="screen" href="http://kp.jon.phosdev.se/stylesheet.php?cssid=31&mediatype=screen" />
<link rel="stylesheet" type="text/css" media="screen" href="http://kp.jon.phosdev.se/stylesheet.php?cssid=32&mediatype=screen" />
<link rel="stylesheet" type="text/css" media="screen" href="http://kp.jon.phosdev.se/stylesheet.php?cssid=35&mediatype=screen" />
<link rel="stylesheet" type="text/css" media="screen" href="http://kp.jon.phosdev.se/stylesheet.php?cssid=36&mediatype=screen" />
<link rel="stylesheet" type="text/css" media="handheld" href="http://kp.jon.phosdev.se/stylesheet.php?cssid=41&mediatype=handheld" />
<link rel="start" title="Home Page, shortcut key=1" href="http://kp.jon.phosdev.se/" />
<link rel="prev" title="Home Page, shortcut key=1" href="http://kp.jon.phosdev.se/" />
<link rel="next" title="How CMSMS Works" href="http://kp.jon.phosdev.se/index.php?page=how-cmsms-works" />
<__script__ type="text/JavaScript">
<!--
//pass min and max -measured against window width
function P7_MinMaxW(a,b){
var nw="auto",w=document.documentElement.clientWidth;
if(w>=b){nw=b+"px";}if(w<=a){nw=a+"px";}return nw;
}
//-->
</__script>
<!--[if lte IE 6]>
<style type="text/css">
#pagewrapper {width:expression(P7_MinMaxW(720,950));}
#container {height: 1%;}
</style>
<![endif]-->
</head>
</__body>
<div id="pagewrapper">
<ul class="accessibility">
<li><a href="/index.php?mact=NMS,m6,pdi_usersettings,1&m6uniqueid=3701da26f0105d8052e7a1f59f4f0f6e&m6returnid=61&page=61#menu_vert" title="Skip to navigation" accesskey="n">Skip to navigation</a></li>
<li><a href="/index.php?mact=NMS,m6,pdi_usersettings,1&m6uniqueid=3701da26f0105d8052e7a1f59f4f0f6e&m6returnid=61&page=61#main" title="Skip to content" accesskey="s">Skip to content</a></li>
</ul>
<hr class="accessibility" />
<div id="header">
<h1><a href="http://kp.jon.phosdev.se/" title="Home Page, shortcut key=1">Kristoffers test</a></h1>
<hr class="accessibility" />
</div>
<div id="search">
<form id="cntnt01moduleform_1" method="get" action="index.php"><div class="hidden"><input type="hidden" name="mact" value="Search,cntnt01,dosearch,0" /><input type="hidden" name="cntnt01returnid" value="61" /></div>
<label for="cntnt01searchinput">Search</label>: <input type="text" id="cntnt01searchinput" name="cntnt01searchinput" size="20" maxlength="50" value="Enter Search..." onfocus="if(this.value==this.defaultValue) this.value='';" onblur="if(this.value=='') this.value=this.defaultValue;"/><input name="submit" value="Submit" type="submit" />
</form>
</div>
<div class="breadcrumbs">
You are here: <a href="http://kp.jon.phosdev.se/">Home</a> » <a href="http://kp.jon.phosdev.se/">Home</a> » <span class="lastitem">Prenumerantsida</span>
<hr class="accessibility" />
</div>
<div id="content">
<div id="sidebar">
<div id="menu_vert">
<h2 class="accessibility">Navigation</h2>
<ul>
<li class="activeparent"><a class="activeparent" href="http://kp.jon.phosdev.se/" accesskey="1" title="Home Page, shortcut key=1"><dfn>1: </dfn>Home</a>
<ul>
<li class="currentpage"><h3><dfn>Current page is 1.1: </dfn>Prenumerantsida</h3>
</li></ul>
</li>
<li><a href="http://kp.jon.phosdev.se/index.php?page=how-cmsms-works"><dfn>2: </dfn>How CMSMS Works</a>
</li>
<li><a href="http://kp.jon.phosdev.se/index.php?page=default_templates"><dfn>3: </dfn>Default Templates Explained</a>
</li>
<li><a href="http://kp.jon.phosdev.se/index.php?page=extensions"><dfn>4: </dfn>Default Extensions</a>
</li>
<li><a href="http://kp.jon.phosdev.se/index.php?page=feed"><dfn>5: </dfn>Feed</a>
</li>
<li><a href="http://kp.jon.phosdev.se/index.php?page=zones"><dfn>6: </dfn>Zoner</a>
</li>
</ul>
</div>
<div id="news">
<h2>News</h2>
</div>
</div>
<div id="main">
<div style="float: right;"><a href='http://kp.jon.phosdev.se/index.php?mact=Printing,m5,printpage,1&m5showbutton=1&m5script=1&m5returnid=61&page=61' class='noprint' > <img src='modules/Printing/printbutton.gif' alt='Print this page' />
</a>
</div>
<h2>Prenumerantsida</h2>
<h2>Nya taggar</h2>
<p><pre>Array
(
)
</pre><pre>Array
(
[action] => pdi_default
[mode] => subscribe
[select] => Militanta köttätare
[module] => NMS
[uniqueid] => 3701da26f0105d8052e7a1f59f4f0f6e
[returnid] => 61
)
</pre><h1>Ändra din prenumeration</h1><br /><p><b>E-post:</b> kristoffer.paulsson@phosworks.se<br /><b>Namn:</b> Kristoffer2</p><form id="m6moduleform_2" method="post" action="index.php"><div class="hidden"><input type="hidden" name="mact" value="NMS,m6,pdi_usersettings,1" /><input type="hidden" name="m6returnid" value="61" /><input type="hidden" name="page" value="61" /></div>
<input type="hidden" name="m6uniqueid" value="3701da26f0105d8052e7a1f59f4f0f6e" />
<input type="hidden" name="m6myfunc" value="change" />
<p><input type="checkbox" name="m6list[1]" value="1" checked="checked" />
Militanta köttätare - Morötter är mord</p><p><input type="checkbox" name="m6list[2]" value="2" />
Militanta gnagare - Jordnötssmör är mord</p><table><tr><td><input name="m6change" value="Ändra prenumerationer" type="submit" />
</form>
</td><td><form id="m6moduleform_3" method="post" action="index.php"><div class="hidden"><input type="hidden" name="mact" value="NMS,m6,pdi_usersettings,1" /><input type="hidden" name="m6returnid" value="61" /><input type="hidden" name="page" value="61" /></div>
<input type="hidden" name="m6uniqueid" value="3701da26f0105d8052e7a1f59f4f0f6e" />
<input name="m6unsubscribe" value="Ta bort mig" type="submit" />
<input type="hidden" name="m6myfunc" value="unsubscribe" />
</form>
</td><td><form id="m6moduleform_4" method="post" action="index.php"><div class="hidden"><input type="hidden" name="mact" value="NMS,m6,pdi_usersettings,1" /><input type="hidden" name="m6returnid" value="61" /><input type="hidden" name="page" value="61" /></div>
<input type="hidden" name="m6uniqueid" value="3701da26f0105d8052e7a1f59f4f0f6e" />
<input name="m6cancel" value="Avbryt" type="submit" />
<input type="hidden" name="m6myfunc" value="cancel" />
</form>
</td></tr></table><hr /></p> <br />
<div class="hr"></div>
<div class="right49">
<p><a href="/index.php?mact=NMS,m6,pdi_usersettings,1&m6uniqueid=3701da26f0105d8052e7a1f59f4f0f6e&m6returnid=61&page=61#main">^ Top</a></p>
</div>
<div class="left49">
<p>Previous page: <a href="http://kp.jon.phosdev.se/" title="Home Page, shortcut key=1">Home</a> <br />
Next page: <a href="http://kp.jon.phosdev.se/index.php?page=how-cmsms-works" title="How CMSMS Works">How CMSMS Works</a></p>
</div>
<hr class="accessibility" />
</div>
</div>
<div id="footer">
<p>© Copyright 2004-2008 - CMS Made Simple<br />
This site is powered by <a href="http://www.cmsmadesimple.org">CMS Made Simple</a> version 1.4.1</p>
</div>
</div><__body>
</__html><!-- 0.344071 / 28 / 6673420 / 6992240 -->
http://kp.jon.phosdev.se/index.php
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Kristoffers test - Prenumerantsida</title>
<base href="http://kp.jon.phosdev.se/" />
<meta name="Generator" content="CMS Made Simple - Copyright (C) 2004-6 Ted Kulp. All rights reserved." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="print" href="http://kp.jon.phosdev.se/stylesheet.php?cssid=30&mediatype=print" />
<link rel="stylesheet" type="text/css" media="screen" href="http://kp.jon.phosdev.se/stylesheet.php?cssid=31&mediatype=screen" />
<link rel="stylesheet" type="text/css" media="screen" href="http://kp.jon.phosdev.se/stylesheet.php?cssid=32&mediatype=screen" />
<link rel="stylesheet" type="text/css" media="screen" href="http://kp.jon.phosdev.se/stylesheet.php?cssid=35&mediatype=screen" />
<link rel="stylesheet" type="text/css" media="screen" href="http://kp.jon.phosdev.se/stylesheet.php?cssid=36&mediatype=screen" />
<link rel="stylesheet" type="text/css" media="handheld" href="http://kp.jon.phosdev.se/stylesheet.php?cssid=41&mediatype=handheld" />
<link rel="start" title="Home Page, shortcut key=1" href="http://kp.jon.phosdev.se/" />
<link rel="prev" title="Home Page, shortcut key=1" href="http://kp.jon.phosdev.se/" />
<link rel="next" title="How CMSMS Works" href="http://kp.jon.phosdev.se/index.php?page=how-cmsms-works" />
<__script__ type="text/JavaScript">
<!--
//pass min and max -measured against window width
function P7_MinMaxW(a,b){
var nw="auto",w=document.documentElement.clientWidth;
if(w>=b){nw=b+"px";}if(w<=a){nw=a+"px";}return nw;
}
//-->
</__script>
<!--[if lte IE 6]>
<style type="text/css">
#pagewrapper {width:expression(P7_MinMaxW(720,950));}
#container {height: 1%;}
</style>
<![endif]-->
</head>
</__body>
<div id="pagewrapper">
<ul class="accessibility">
<li><a href="/index.php#menu_vert" title="Skip to navigation" accesskey="n">Skip to navigation</a></li>
<li><a href="/index.php#main" title="Skip to content" accesskey="s">Skip to content</a></li>
</ul>
<hr class="accessibility" />
<div id="header">
<h1><a href="http://kp.jon.phosdev.se/" title="Home Page, shortcut key=1">Kristoffers test</a></h1>
<hr class="accessibility" />
</div>
<div id="search">
<form id="cntnt01moduleform_1" method="get" action="index.php"><div class="hidden"><input type="hidden" name="mact" value="Search,cntnt01,dosearch,0" /><input type="hidden" name="cntnt01returnid" value="61" /></div>
<label for="cntnt01searchinput">Search</label>: <input type="text" id="cntnt01searchinput" name="cntnt01searchinput" size="20" maxlength="50" value="Enter Search..." onfocus="if(this.value==this.defaultValue) this.value='';" onblur="if(this.value=='') this.value=this.defaultValue;"/><input name="submit" value="Submit" type="submit" />
</form>
</div>
<div class="breadcrumbs">
You are here: <a href="http://kp.jon.phosdev.se/">Home</a> » <a href="http://kp.jon.phosdev.se/">Home</a> » <span class="lastitem">Prenumerantsida</span>
<hr class="accessibility" />
</div>
<div id="content">
<div id="sidebar">
<div id="menu_vert">
<h2 class="accessibility">Navigation</h2>
<ul>
<li class="activeparent"><a class="activeparent" href="http://kp.jon.phosdev.se/" accesskey="1" title="Home Page, shortcut key=1"><dfn>1: </dfn>Home</a>
<ul>
<li class="currentpage"><h3><dfn>Current page is 1.1: </dfn>Prenumerantsida</h3>
</li></ul>
</li>
<li><a href="http://kp.jon.phosdev.se/index.php?page=how-cmsms-works"><dfn>2: </dfn>How CMSMS Works</a>
</li>
<li><a href="http://kp.jon.phosdev.se/index.php?page=default_templates"><dfn>3: </dfn>Default Templates Explained</a>
</li>
<li><a href="http://kp.jon.phosdev.se/index.php?page=extensions"><dfn>4: </dfn>Default Extensions</a>
</li>
<li><a href="http://kp.jon.phosdev.se/index.php?page=feed"><dfn>5: </dfn>Feed</a>
</li>
<li><a href="http://kp.jon.phosdev.se/index.php?page=zones"><dfn>6: </dfn>Zoner</a>
</li>
</ul>
</div>
<div id="news">
<h2>News</h2>
</div>
</div>
<div id="main">
<div style="float: right;"><a href='http://kp.jon.phosdev.se/index.php?mact=Printing,m5,printpage,1&m5showbutton=1&m5script=1&m5returnid=61&page=61' class='noprint' > <img src='modules/Printing/printbutton.gif' alt='Print this page' />
</a>
</div>
<h2>Prenumerantsida</h2>
<h2>Nya taggar</h2>
<p><br />
<b>Warning</b>: Parameter myfunc is not known... dropped in <b>/home/sites/kp.jon.phosdev.se/web/lib/misc.functions.php</b> on line <b>1301</b><br />
<br />
<b>Warning</b>: Parameter list is not known... dropped in <b>/home/sites/kp.jon.phosdev.se/web/lib/misc.functions.php</b> on line <b>1301</b><br />
<br />
<b>Warning</b>: Parameter change is not known... dropped in <b>/home/sites/kp.jon.phosdev.se/web/lib/misc.functions.php</b> on line <b>1301</b><br />
<pre>Array
(
[mact] => NMS,m6,pdi_usersettings,1
[m6returnid] => 61
[page] => 61
[m6uniqueid] => 3701da26f0105d8052e7a1f59f4f0f6e
[m6myfunc] => change
[m6list] => Array
(
[1] => 1
[2] => 2
)
[m6change] => Ändra prenumerationer
)
</pre><pre>Array
(
[action] => pdi_default
[mode] => subscribe
[select] => Militanta köttätare
[module] => NMS
[returnid] => 61
[uniqueid] => 3701da26f0105d8052e7a1f59f4f0f6e
)
</pre><h1>Ändra din prenumeration</h1><br /><p><b>E-post:</b> kristoffer.paulsson@phosworks.se<br /><b>Namn:</b> Kristoffer2</p><form id="m6moduleform_2" method="post" action="index.php"><div class="hidden"><input type="hidden" name="mact" value="NMS,m6,pdi_usersettings,1" /><input type="hidden" name="m6returnid" value="61" /><input type="hidden" name="page" value="61" /></div>
<input type="hidden" name="m6uniqueid" value="3701da26f0105d8052e7a1f59f4f0f6e" />
<input type="hidden" name="m6myfunc" value="change" />
<p><input type="checkbox" name="m6list[1]" value="1" checked="checked" />
Militanta köttätare - Morötter är mord</p><p><input type="checkbox" name="m6list[2]" value="2" />
Militanta gnagare - Jordnötssmör är mord</p><table><tr><td><input name="m6change" value="Ändra prenumerationer" type="submit" />
</form>
</td><td><form id="m6moduleform_3" method="post" action="index.php"><div class="hidden"><input type="hidden" name="mact" value="NMS,m6,pdi_usersettings,1" /><input type="hidden" name="m6returnid" value="61" /><input type="hidden" name="page" value="61" /></div>
<input type="hidden" name="m6uniqueid" value="3701da26f0105d8052e7a1f59f4f0f6e" />
<input name="m6unsubscribe" value="Ta bort mig" type="submit" />
<input type="hidden" name="m6myfunc" value="unsubscribe" />
</form>
</td><td><form id="m6moduleform_4" method="post" action="index.php"><div class="hidden"><input type="hidden" name="mact" value="NMS,m6,pdi_usersettings,1" /><input type="hidden" name="m6returnid" value="61" /><input type="hidden" name="page" value="61" /></div>
<input type="hidden" name="m6uniqueid" value="3701da26f0105d8052e7a1f59f4f0f6e" />
<input name="m6cancel" value="Avbryt" type="submit" />
<input type="hidden" name="m6myfunc" value="cancel" />
</form>
</td></tr></table><hr /></p> <br />
<div class="hr"></div>
<div class="right49">
<p><a href="/index.php#main">^ Top</a></p>
</div>
<div class="left49">
<p>Previous page: <a href="http://kp.jon.phosdev.se/" title="Home Page, shortcut key=1">Home</a> <br />
Next page: <a href="http://kp.jon.phosdev.se/index.php?page=how-cmsms-works" title="How CMSMS Works">How CMSMS Works</a></p>
</div>
<hr class="accessibility" />
</div>
</div>
<div id="footer">
<p>© Copyright 2004-2008 - CMS Made Simple<br />
This site is powered by <a href="http://www.cmsmadesimple.org">CMS Made Simple</a> version 1.4.1</p>
</div>
</div><__body>
</__html><!-- 0.250983 / 24 / 5934420 / 6180104 -->
If that's the case could someone give me a hint or a resource on the topic?
thnx
Re: Problems getting frontend form data into params variable
For frontend functions of a module you need to register the parameters that can be used with that module.krillzip wrote: ...
Warning: Parameter myfunc is not known... dropped in /home/sites/kp.jon.phosdev.se/web/lib/misc.functions.php on line 1301
...
(I guess that is some security stuff here.)
Take a look into the News Modules source code of the file News.module.php.
There is a function called SetParameters(). Notice the lines 90 and below.
Maybe that's the reason why the variables are in the $_POST array but not in the $params array.
Re: Problems getting frontend form data into params variable
That's it! 
Work's great

Work's great