Page 1 of 1

Placing html and php in a php variable?

Posted: Mon Oct 28, 2002 4:23 am
by mikebr
I am working on a script that contains a form, as it is complicated and probably not possible to use headers to redirect the user to different pages I am writing this script with variables to print blocks of html, one of those blocks is a login page if a new user joins up, the problem is that I am getting parse errors with a variable that contains html and php code, is this possible to do? or can a variable not contain both?

Example:

Code: Select all

$login_page='<STYLE TYPE="text/css">
<--
.style1 &#123; font-size: 11px; &#125;
.style2 &#123; font-size: 12px; &#125;
--></STYLE>
<script SOME_JAVASCRIPT>
<P ALIGN CENTER><?php include "footer.html";?></P></TD>
<TD HEIGHT=15 WIDTH=512 COLSPAN=2 VALIGN=TOP>
<P><?PHP
if empty($welcometext) &#123;
$text1="Enter your password";
&#125; else &#123;
echo "$welcometext); 
&#125;
?>
</P></TD></TR>
<TR><TD HEIGHT=20 

MORE HTML
Thanks

Posted: Mon Oct 28, 2002 4:51 am
by Phirus
Thats nearly impossible and to be honest pointless..

Why not just use includes and functions.

http://www.php.net/manual/en/functions.php
http://www.php.net/manual/en/function.include.php

Go do some reading..

Phirus