0

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 "<input type=hidden name=value value=".$value[0].">";
//when echoed in the form action page as $_POST, 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 </input> tag. //no effect
b) closing php and using plain html as in:
?> <input type=hidden name=value value= <?php echo $value[0]; ?> > <?php //no effect

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by martin11ph
1

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]}' />";

Edited by pritaeas: n/a

Votes + Comments
Dead on right answer
0

Thank you very much pritaeas. This has certainly solved the problem. Going to close now.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.