PHP Echo with System Command
<p>i need to call a variable ($id) within a php system command. I'm automating a solr curl delete command, and it works with a static id, but i need to echo the $id so it deletes the correct document.</p>

<p>code is:</p>

<pre><code>&lt;?php
echo '&lt;pre&gt;';

$last_line = system('curl http://localhost:8983/solr/imagedb/update?commit=true --data \'&lt;delete&gt;&lt;query&gt;id\:&lt;?php echo $id; ?&gt;&lt;/query&gt;&lt;/delete&gt;\' -H \'Content-type:text/xml; charset=utf-8\'', $retval);

// Printing additional info
echo '
&lt;/pre&gt;
&lt;hr /&gt;Last line of the output: ' . $last_line . '
&lt;hr /&gt;Return value: ' . $retval;
?&gt;
</code></pre>

<p>The code shows no error but the document is not deleted so it is not grabbing the $id variable. Its an echo within a php system command. How to make it work? </p>