Note that there are some explanatory texts on larger screens.

plurals
  1. POundefined notice when trying to create hyperlink
    primarykey
    data
    text
    <p>When trying to set the hyperlinks for each image name I am getting an undefined <code>imgitem</code> notice in the hyperlink(s). Am I placing the <code>&lt;a&gt;</code> tags in incorrect place?</p> <pre><code>echo '&lt;td width="11%" class="imagetd"&gt;'; if (empty($arrImageFile[$key])) { echo '&amp;nbsp;'; } else { echo '&lt;ul class="qandaul"&gt;&lt;li&gt;&lt;a href="previewImage.php?imgId=[$imgitem]" target="_blank"&gt;'; echo implode("&lt;/li&gt;\n&lt;li&gt;&lt;/a&gt;&lt;a href='previewImage.php?imgId=[$imgitem]' target='_blank'&gt;", array_map(function($imgitem){ return htmlspecialchars($imgitem); }, $arrImageFile[$key])); echo '&lt;/li&gt;&lt;/ul&gt;&lt;/a&gt;'; } echo '&lt;/td&gt;'; </code></pre> <p><strong>UPDATE:</strong></p> <p>Current code which is not working:</p> <pre><code> &lt;table id="tableqanda" cellpadding="0" cellspacing="0"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th width="11%" class="image"&gt;Image&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;/table&gt; &lt;div id="tableqanda_onthefly_container"&gt; &lt;table id="tableqanda_onthefly" cellpadding="0" cellspacing="0"&gt; &lt;tbody&gt; &lt;?php function imageName( $imgitem ) { return htmlspecialchars($imgitem); //432 } foreach ($arrQuestionId as $key=&gt;$question) { echo '&lt;tr class="tableqandarow"&gt;'.PHP_EOL; echo '&lt;td width="11%" class="imagetd"&gt;'; if (empty($arrImageFile[$key])) { echo '&amp;nbsp;'; } else { echo '&lt;ul class="qandaul"&gt;&lt;li&gt;&lt;a href="previewImage.php?imgId=[' . $imgitem . ']" target="_blank"&gt;'; //line 456 echo implode('&lt;/li&gt;\n&lt;li&gt;&lt;/a&gt;&lt;a href="previewImage.php?imgId=[' . $imgitem . ']" target="_blank"&gt;', imageName($arrImageFile[$key]) ); //line 457 echo '&lt;/li&gt;&lt;/ul&gt;&lt;/a&gt;'; } echo '&lt;/td&gt;'; echo '&lt;/tr&gt;'.PHP_EOL; } ?&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; </code></pre> <p>Errors received:</p> <p>Warning: htmlspecialchars() expects parameter 1 to be string, array given in ... on line 432</p> <p>Notice: Undefined variable: imgitem in ... on line 456</p> <p>Notice: Undefined variable: imgitem in ... on line 457 </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. 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