Re: embedding php inside of php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jun 30, 2012 at 8:00 PM, Tim Dunphy <bluethundr@xxxxxxxxx> wrote:
> Hello,
>
>  I am trying to get the hang of php using some examples that I found
> in a book. I've been making progress lately, but one thing has me a
> bit stumped.
>
>
> In an HTML form that I am echoing through PHP I would like to embed
> smaller chunks of php in the code like so:
>
>
>  echo '<br /><br />
>         <form method="post" action="sendemail.php">
>         <label for="subject">Subject of email:</label><br />
>         <input id="subject" name="subject" type="text" value="<?php
> echo $subject;?>"><br />

    You're trying to open PHP tags within a PHP code block.  Drop the
nested <?php echo $subject; ?> and replace it with:

        '.$subject.'

    Thus:

        echo '<br/><br/>
            <form method="post" action="sendmail.php">
            <label for="subject">Subject of email </label><br/>
            <input id="subject" name="subject" type="text"
value="'.$subject.'"><br/>

-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux