benhowdle89
benhowdle89

Reputation: 37494

Echoing html and $_POST

echo "<p id='xlday'>'$_POST['day']'</p>";

Hi can anyone help me solve this problem, should be a simple one but i'm struggling for some reason! Thanks

Upvotes: 1

Views: 146

Answers (4)

Alin P.
Alin P.

Reputation: 44346

echo "<p id='xlday'>".$_POST['day']."</p>";

or

echo "<p id='xlday'>{$_POST['day']}</p>";

or

echo "<p id='xlday'>${_POST['day']}</p>";

or

echo "<p id='xlday'>$_POST[day]</p>";



I'll also add

echo "<p id='xlday'>", $_POST['day'], "</p>";

with the mention that it does not actually concatenate the strings, but rather outputs them one at a time.

Upvotes: 2

jack
jack

Reputation: 1435

You can also do like:

echo "{$_REQUEST['day']}

";

However we prefer output buffering.

http://www.suite101.com/content/output-buffer-in-php-a26768

Upvotes: -1

Repox
Repox

Reputation: 15476

Do like this:

echo "<p id='xlday'>".$_POST['day']."</p>";

Upvotes: 0

SW4
SW4

Reputation: 71200

echo "<p id='xlday'>".$_POST['day']."</p>";

Upvotes: 3

Related Questions