Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><em><strong>UPDATE</strong> ok, Now I see you have edited and corected the mistake in your code in question. But still <code>&lt;?php =$hobby ?&gt;</code> doesn't make sense to me. It tells nothing to do to PHP parser. Use <code>echo</code> there, as explained in my answer.</em></p> <p>The only possible explanation of your problem is that the code being used in producing the <code>hobby</code> input field, specifically this fragment <code>value=&amp;lt;?=$hobby?&amp;gt;</code> is having problem.</p> <p>Reason:<br> PHP processes a <code>&amp;lt;?</code> and <code>&lt;?</code> differently. Former is echoed as-it-is, and latter tells PHP that PHP code is started at this point, and process it. Then an un-neccesarry <code>=</code> and missing <code>;</code>.</p> <p>Solution:<br> First of all use <code>value="&lt;?php echo $hobby; ?&gt;"</code> Use of full PHP tags () is always recommended over short tags () Then you need to tell PHP to echo/print the value of <code>$hobby</code> here by using <code>echo</code>. Now the output HTML should be <code>value="_Some_Hobby_"</code></p> <p>Now, if still the output HTML is <code>value=""</code> i.e. empty, then you need to check if <code>$hobby</code> actually holds a value.</p> <p>As seen at <a href="http://codepad.org/dvf9bwSd" rel="nofollow">http://codepad.org/dvf9bwSd</a> in Case 3,</p> <pre><code> value="&amp;lt;?php echo $hobby; ?&amp;gt;" </code></pre> <p>PHP Parser just chunks out the <code>&amp;lt;php .... ?&amp;gt;</code> thing as-it-is. So use literal <code>&lt;</code> &amp; <code>&gt;</code>.</p> <p>Now, in Case 1,</p> <pre><code>value="&lt;?php echo $hobby; ?&gt;" &lt;?php var_dump($hobby); ?&gt; </code></pre> <p>echoing <code>$hobby</code> variable <strong>without</strong> assigning it any value prints nothing. And <code>var_dump</code> also returns <code>NULL</code> </p> <p>Moving on to case-2, </p> <pre><code>&lt;?php $hobby = "Coding"; ?&gt; value="&lt;?php echo $hobby; ?&gt;" &lt;? var_dump($hobby); ?&gt; </code></pre> <p>defining/assigning a value to <code>$hobby</code> and then echoing it gives us the desired result <code>value="Coding"</code> and <code>var_dump</code> also says it is a <code>String</code> of <code>length=6</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload