get hidden input value

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lmh85
Forum Commoner
Posts: 49
Joined: Sat Oct 28, 2006 10:49 am

get hidden input value

Post by lmh85 »

i had tried
<input type="hidden" name="hiddenFields" value=<?php print($hiddenFields); ?>>
and yes it works when i just call out $hiddenFields and parsing it into a session. But when i tried calling it using $_POST['hiddenFields'] , it can't work. Is there any way else i can get the values of my hidden fields instead of the above method(bcos its not working in my web hosting server). Please help! thanks in advance!
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

To me it appears that you're trying to stuff the value of an array in a single hidden field?? In that case i suggest that you look at the generated html to get an idea of why the print $hiddenfields is not the value that you're expecting....
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Probably for a lack of quotes. Why not transfer the data via sessions so the user cannot directly affect the data contained inside?
lmh85
Forum Commoner
Posts: 49
Joined: Sat Oct 28, 2006 10:49 am

Post by lmh85 »

it works in apache.. but not in IIS.. i wonder why.. hmmm.. i can't get it to be in the session as the values all gone when my button is clicked...
lmh85
Forum Commoner
Posts: 49
Joined: Sat Oct 28, 2006 10:49 am

Post by lmh85 »

anybody help? :(
brendandonhue
Forum Commoner
Posts: 71
Joined: Mon Sep 25, 2006 3:21 pm

Post by brendandonhue »

Try making your form field like this
<input type="hidden" name="hiddenFields" value="<?php echo $hiddenFields; ?>">
Then use $_POST['hiddenFields'] to get the value. Be aware that the user could change that value, it's not necessarily going to be the same as what you put in the hidden field.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

lmh85 wrote:anybody help? :(
Please do not bump your threads.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:4. All users of any level are restricted to bumping (as defined here) any given thread within twenty-four (24) hours of its last post. Non-trivial posts are not considered bumping. A bump post found in violation will be deleted, and you may or may not recieve a warning. Persons bumping excessively be considered as spammers and dealt with accordingly.
As for the problem you are having, if there is an issue with not being to use sessions in IIS, it might be a permissions issue.

As for passing a hidden field, it should work fine as long as what is in the hidden field is what you expect. As has been mentioned in this thread, try looking at the generated output of the PHP you are trying put into the hidden field and see what it is. That might help.
wyrmmage
Forum Commoner
Posts: 56
Joined: Sat Oct 28, 2006 12:43 pm
Location: boise, ID

Post by wyrmmage »

why are you calling print"" inside your value="" part of your tag? I'm pretty sure you don't need to do that...
-wyrmmage
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Its inside the PHP tag, so he will either need a print() or an echo().
wyrmmage
Forum Commoner
Posts: 56
Joined: Sat Oct 28, 2006 12:43 pm
Location: boise, ID

Post by wyrmmage »

ah, ok.
If it's possible, I would just echo('') the entire form, it makes it much easier to insert php variables into it.
-wyrmmage
Post Reply