Reputation:
Hello I'm trying to send one variable with POST (Hello Angel). That is the code:
<form action="dos.php" method="post" name="compra">
<input name="id_txt" type="hidden" value=<?php echo "Hello Angel" ?>/>
<input type="submit" name="Send" value="Send" />
</form>
when in the other page show the variable, only shows up space (only Hello). That is the code:
<?php
if (isset($_POST['id_txt']))
echo $_POST['id_txt']
?>
So, how Can I show all?
Upvotes: 0
Views: 104
Reputation: 472
You're missing the quotes around the input value
Change:
<input name="id_txt" type="hidden" value=<?php echo "Hello Angel" ?> />
To:
<input name="id_txt" type="hidden" value="<?php echo "Hello Angel" ?>" />
Upvotes: 4
Reputation: 850
Quote your value like this:
<input name="id_txt" type="hidden" value="<?php echo "Hello Angel"; ?>" />
When you don't put quotes around an HTML attribute value it only takes the first word as the value.
Upvotes: 5