Hello !
I am using a combobox in a HTML pages. The combo is filled dynamically with values from database.
When i am reading those variables i can find only the first word of the sentence.
here is what i have done :
(HTML)
// HTML code to show the whole list of a product
<*select name="liste3" id="liste3">
<*option value="">BAIE
<*!--[foreach from=$id_baie item=iden]-->
<*option value=>
<*!--[/foreach]-->
<*/select>
(PHP)
$mac = FormUtil::getPassedValue('liste_macro',isset($args['liste_macro']) ? $args['liste_macro'] : null, 'REQUEST');
P.S : $mac variable is filled with the first word of the combo sentence
Do you have any idea about the problem ? thx
edited by: DJUS, Apr 07, 2008 - 03:06 PM
Forum Activity
- Redirect variable. on Mar 16
- problems with timeIT pop-up calender not inserting/applying date - maybe ??? on Mar 16
- how to change the format of shorturls on Mar 15
- the meta options in news are not showing the dates on Mar 15
- new theme 3TBase available on Mar 15
- Chat bar Module on Mar 15
- Chat module? on Mar 15
Zikula Blog
- How to Become a HipHop Fan on Feb 03
- HTML5 on Feb 02
- Support Free Software on Jan 22
- Module Files available on Dec 13
- Why I love Zikula (Reason #768) on Nov 11
- Theme Creator? on Nov 08
- Time to Embrace PHP 5 on Nov 08
Login
Problem retrieving HTML variables
-
- Rank: Professional
- Registered: 05.01.03
- last visit: 15.03.10
- Posts: 648
Looking at your select list code, your call to FormUtil::getPassedValue() should use "liste3" as the first parameter ...
Greetings
R
-
**unknown user**
- Rank: Freshman
- Registered: 16.03.02
- last visit: 18.08.08
- Posts: 19
I am sorry i made a copy paste error when i was writting this message ! you are right rgash i was using liste_macro not liste3!
<*select name="liste_macro" id="liste_macro">
<*option value="">
<*!--[foreach from=$macro item=mac]-->
<*option value=>
<*!--[/foreach]-->
<*/select>
(PHP)
$mac = FormUtil::getPassedValue('liste_macro',isset($args['liste_macro']) ? $args['liste_macro'] : null, 'REQUEST');
Always the same problem
Greetings
edited by: DJUS, Apr 08, 2008 - 04:05 PM -
- Rank: Professional
- Registered: 05.01.03
- last visit: 15.03.10
- Posts: 648
Are you sure you have this selector in a "form" tag?
Otherwise, in your code where you have your FormUtil::getPassedValue() call, place the following line:
prayer ($_REQUEST);
This will show you what's in $_REQUEST (ie: what has been posted). If you don't see any output, place an "exit()" call after the prayer() call ... this is sometimes required when you immideately redirect ...
Greetings
R -
**unknown user**
- Rank: Freshman
- Registered: 16.03.02
- last visit: 18.08.08
- Posts: 19
I use a form for my selector. And i palced a prayer ($_REQUEST) which showed me the value of each variable, liste_macro too : (string) liste_macro = Pouvoir
While what i selected in my combo box for example was the following sentence : Pouvoir separateur en atténuation
thanx for your help rgash!
Greetings
-
- Rank: Professional
- Registered: 05.01.03
- last visit: 15.03.10
- Posts: 648
Could it be that you didn't enclose your value in quotes? Take a look at your HTML source code in order to verify this ...
Greetings
R -
**unknown user**
- Rank: Freshman
- Registered: 16.03.02
- last visit: 18.08.08
- Posts: 19
I don't think so, anyway i took a look at my HTML code and i couldn't find any error!
here is my form:
<*form class="numuserdate" action="" method="post" *enctype="application/x-www-form-urlencoded">
<*input type="text" name="macro_val" id="macro_val" value=""/>
<*input type="text" name="macro_ns" id="macro_ns" value=""/>
<*select name="liste_macro" id="liste_macro">
<*!--[foreach from=$macro item=mac]-->
<*option value=>
<*!--[/foreach]-->
<*/select>
Greetings
edited by: DJUS, Apr 09, 2008 - 05:41 PM -
- Rank: Professional
- Registered: 05.01.03
- last visit: 15.03.10
- Posts: 648
Unfortunately, your select tag code above is incomplete, so I can't quite tell you what the issue is. Fact is, FormUtil is used extensively throughout PN and we've never seen a failure that couldn't be explained by a user/developer coding error.
Please post your complete HTML code for further analysis ...
Greetings
R -
**unknown user**
- Rank: Freshman
- Registered: 16.03.02
- last visit: 18.08.08
- Posts: 19
Ok! I am sorry i should have post the whole code from the beginning !
Here is my code HTML:
<*form class="numuserdate" action=""
*method="post" enctype="application/x-www-form-urlencoded">
<*input type="text" name="macro_val" id="macro_val" value=""/>
<*input type="text" name="macro_ns" id="macro_ns" value=""/>
<*select name="liste_macro" id="liste_macro">
<*!--[foreach from=$macro item=mac]-->
<*option value=>
<*!--[/foreach]-->
<*/select>
<*input name="submit" type="submit" value="OK" />
<*input type="text" name="affich_macro" id="affich_macro" value=""/>
<*/form>
My PHP code :
$mac = FormUtil::getPassedValue('liste_macro',isset($args['liste_macro']) ? $args['liste_macro'] : null, 'REQUEST');
Greetings
edited by: DJUS, Apr 10, 2008 - 11:22 AM -
- Rank: Moderator
- Registered: 18.03.02
- last visit: 21.10.09
- Posts: 6611
You must use code tags to post code here - see the 'select code type' drop down for specific code formatting types.
-Mark
--
Visit My homepage and Zikula themes. -
**unknown user**
- Rank: Freshman
- Registered: 16.03.02
- last visit: 18.08.08
- Posts: 19
Here it is :
Code
<form class="numuserdate" action="<!--[pnmodurl modname="num" type="user" func="macro"]-->" method="post"enctype="application/x-www-form-urlencoded">
<input type="text" name="macro_val" id="macro_val" value="<!--[$type]-->"/>
<input type="text" name="macro_ns" id="macro_ns" value="<!--[$num_serie]-->"/>
<select name="liste_macro" id="liste_macro">
<!--[foreach from=$macro item=mac]-->
<option value=<!--[$mac.lib]-->><!--[$mac.lib]--></option>
<!--[/foreach]-->
</select>
<input name="submit" type="submit" value="OK" />
<input type="text" name="affich_macro" id="affich_macro" value="<!--[$i_mac]-->"/>
</form>
My PHP code :
Code
$mac = FormUtil::getPassedValue('liste_macro',isset($args['liste_macro']) ? $args['liste_macro'] : null, 'REQUEST');
Greetings
edited by: DJUS, Apr 10, 2008 - 12:10 PM -
- Rank: Professional
- Registered: 23.11.03
- last visit: 13.12.09
- Posts: 1486
The value of your option element needs to be double quoted, without them the parser stops reading at the first white space it gets to... hence you only getting the first word. All HTML name value pairs need to be double quoted as a matter of standards. Should look like this:
Code
<option value="<!--[$mac.lib]-->"><!--[$mac.lib]--></option>
--
Under Construction! -
**unknown user**
- Rank: Freshman
- Registered: 16.03.02
- last visit: 18.08.08
- Posts: 19
thanks everybody ! That was my problem !
I used the option value many times in my code without having to extract sentences with white space and it worked! That's why i haven't thought that it was the problem!
thanks again!
- Moderated by :
- Support
Users online
This list is based on the users active over the last 60 minutes.
