explode - i need fix select form on php code -


hello need fix problem on php code. when write value name="" , id="" aren't found. here's code:

<?php     $tipos= $eachoption['option_value'];     $categorias='';     $cats = explode(",",$tipos);     echo "<select name=\"option_<?php echo $eachoption['option_id'];?>[]\" id=\"<?php echo $_post['option_'.$eachoption['option_id']][$i];?>\">";      foreach($cats $cat){         $cat = trim($cat);         $categorias .= "<option>". $cat ."</option>";     }     echo $categorias;     echo "</select>"; ?> 

thanks! think maybe " or ' inside echo.

your php syntax incorrect. cannot embed php-within-php. e.g.

<?php $foo = "<?php echo 'bar' ?>"; 

will not execute echo call. assigning literal characters <, ?, p, etc... string.

since you're using double-quoted strings, don't need echoes simple variable insertions @ all:

echo "<select name=\"option_{$eachoption['option_id']}[]\" id=\"" . $_post['option_'.$eachoption['option_id']][$i]; . "\">";                             ^^^^^^^^^^^^^^^^^^^^^^^^^^ 

note second $_post require breaking out of string mode, since you're dynamically creating array key.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -