Output not the same in form
Hi all. I have this problem within the form. I take data from a DB and pass it on using POST. Considering that I fetched array correctly, the following code has the following output:
echo $value[0];
//echoes Hello World
echo "";
//when echoed in the form action page as $_POST['value'], it echoes Hello only
I don't understand why I can't pass the entire Hello World phrase using hidden inputs. I also tried:
a) closing the input with the tag. //no effect
b) closing php and using plain html as in:
?> > <?php //no effect
martin11ph
Junior Poster in Training
74 posts since Jan 2011
Reputation Points: 7
Solved Threads: 0
Because your tag attributes aren't enclosed within quotes, as per html specifications.
echo '<input type="hidden" name="value" value="' . $value[0] . '" />';
Or this:
echo "<input type='hidden' name='value' value='{$value[0]}' />";
pritaeas
Posting Expert
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
Thank you very much pritaeas. This has certainly solved the problem. Going to close now.
martin11ph
Junior Poster in Training
74 posts since Jan 2011
Reputation Points: 7
Solved Threads: 0