hi
what i am trying to do should be really simple but i just cant get it to work. I am trying to put a form (which i have working on a .php page but can not get it to repeat correctly) inside an echo command.
i have tried
echo ('<form name="login" method="post" action=" <?php echo $PHP_SELF ?>">
<font class="whiteHeader">
username:
<input type="text" name="username">
<br>
password:
<input type="password" name="user_password">
<br>
<input type="submit" value="submit">
</font>
</form>
');
as well as putting it inside ("") and \ escapes. ending with " . before <?php. but i cannot get it to work. and using herdoc, none of which i can get to run. The problem is the way in which it handles going back into php. Have read the chapters regarding this a couple of times but still cant work out what I am doing wrong. How would solve this? if any one has some code that they have written to do something similar I'm sure I could see what I am doing wrong.
Thanks
Deej
using php tags inside echo
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Try:
You cannot echo() within an echo(), instead you need to concenate the string and the variable.
More info:
http://www.php.net/manual/en/language.o ... string.php
Mac
Code: Select all
echo '<form name="login" method="post" action="'.$PHP_SELF.'">
<font class="whiteHeader">
username:
<input type="text" name="username">
<br>
password:
<input type="password" name="user_password">
<br>
<input type="submit" value="submit">
</font>
</form>';More info:
http://www.php.net/manual/en/language.o ... string.php
Mac