Page 1 of 1

Can you use html/css in an echo or print command?

Posted: Wed Jun 05, 2002 1:16 pm
by jmandango
This is what I have right now:

Code: Select all

echo "Thank you! Information entered.\n";
I want to be able to apply a css style to this and/or some html stuff (ie. <table cellpadding="3"><tr><td class="sumptin">Thank you! Information entered.</td></tr></table> )

thank you for your help!

Posted: Wed Jun 05, 2002 1:37 pm
by jason

Code: Select all

echo '<table cellpadding="3"><tr><td class="sumptin">Thank you! Information entered.</td></tr></table>';

echo in an echo?

Posted: Wed Jun 05, 2002 2:19 pm
by jmandango
Sweet that worked. But now, how do I put an echo in an echo?

Here's what I mean:

Code: Select all

echo '<table align="center" cellpadding="3"><tr><td align="center" class="graybold">Thank &#1111;color=#FF0000]&#1111;b]"$first_name"&#1111;/b]&#1111;/color] you for voting!</td></tr></table>';
I want to put the user's name in the above area captured from a form field on the page. Can you put an echo in an echo?

Posted: Wed Jun 05, 2002 2:46 pm
by MattF
This should work:

echo '<table align="center" cellpadding="3"><tr><td align="center" class="graybold">Thank you "$_POST[first_name]" for voting!</td></tr></table>';

hmmm, didn't work

Posted: Wed Jun 05, 2002 3:08 pm
by jmandango
I tried that, $_POST, but it didn't work?

any ideas?

Posted: Wed Jun 05, 2002 3:54 pm
by twigletmac
PHP ignores stuff in strings contained in single quotes so you need something like:

Code: Select all

echo '<table align="center" cellpadding="3"><tr><td align="center" class="graybold">Thank you '.$_POST&#1111;'first_name'].' for voting!</td></tr></table>';
Mac

Posted: Wed Jun 05, 2002 4:15 pm
by hob_goblin
and make sure the form is sent using post :-P

thanks

Posted: Thu Jun 06, 2002 6:58 am
by jmandango
Thank you, the single quote worked. Yee-Haaa!!!!