Hi all,
Can anyone shed any light on why when an input field in a form is submitted, the target form displays the variable OK (after retrieval using $_POST) but after reconstructing the received variable into a hidden field for submission onto another form, the variable is truncated if a space is in the string?
first form - the input field
the receiving form. 1st line grabs received variable from $_POST for passing onto a downstream form. 2 line display variable in the page
received value = test text (all godd so far)
3rd form variable display code.
received value = test (opps, whwre is the word text?)
aj
Can anyone shed any light on why when an input field in a form is submitted, the target form displays the variable OK (after retrieval using $_POST) but after reconstructing the received variable into a hidden field for submission onto another form, the variable is truncated if a space is in the string?
first form - the input field
<INPUT TYPE=TEXT NAME="playerAddress" title="Required" SIZE=60 MAXLENGTH=60>
test input = test textthe receiving form. 1st line grabs received variable from $_POST for passing onto a downstream form. 2 line display variable in the page
<input type=hidden name="playerAddress" value=<?php echo $_POST["playerAddress"];?>>
Address: </B></I><?php echo $_POST["playerAddress"];?>
received value = test text (all godd so far)
3rd form variable display code.
Address: </B></I><?php echo $_POST["playerAddress"];?>
received value = test (opps, whwre is the word text?)
aj
Hi ajw3208,
You need to add quotes round the value - if you check the form html I think you will find you have value=test text. Try this
Bob
PS It's safer to use the filtered values that Joomal provides with JRequest than to use $_POST
PPS You'll see that I prefer single quotes as this lets me use
You need to add quotes round the value - if you check the form html I think you will find you have value=test text. Try this
<input type='hidden' name='playerAddress' value='<?php echo $_POST['playerAddress']; ?>' />
Bob
PS It's safer to use the filtered values that Joomal provides with JRequest than to use $_POST
<input type='hidden' name='playerAddress' value='<?php echo JRequest::getString('playerAddress', '', 'post'); ?>' />
PPS You'll see that I prefer single quotes as this lets me use
echo "<input type='hidden', name='some_name' . . ./>";
but either will work as long as you keep them all consistent.
Bob,
thank you. isn't it strange how things don't work when the tag syntax is incorrect. This error prompted a quick review of other code and sad to say other mistakes were found. 😶
on the bright side, at least they were found
aj
thank you. isn't it strange how things don't work when the tag syntax is incorrect. This error prompted a quick review of other code and sad to say other mistakes were found. 😶
on the bright side, at least they were found
aj
Hi Bob,
I tried the Jrequest version as you suggested above and BANG!
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ',' or ';' in /home/wphcfc/public_html/z-wphctesting/components/com_chronocontact/chronocontact.html.php(141) : eval()'d code on line 2
Code for line 2 as indictaed above
Any idea why
aj
I tried the Jrequest version as you suggested above and BANG!
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ',' or ';' in /home/wphcfc/public_html/z-wphctesting/components/com_chronocontact/chronocontact.html.php(141) : eval()'d code on line 2
Code for line 2 as indictaed above
<input type="hidden" name="playerRegNum" value="<?php echo $JRequest::getString('playerRegNum','','post');?>" />
Any idea why
aj
This topic is locked and no more replies can be posted.