$numnames = 10;
                for($i=1; $i <=$numnames; $i++){
                    $temp = "name$i";
                    echo htmlspecialchars($$temp).'<br/s>'; //or whatever processing you want to do
                }

Warning: Undefined variable $name1 in /var/www/html/PHP-and-MySQL-Web-Development/Chapter01/exercise12/freight.php on line 39

Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/PHP-and-MySQL-Web-Development/Chapter01/exercise12/freight.php on line 39

    $$temp should probably just be $temp. Using a double $$ can be valid if you intend to use a "variable variable", but that's likely not the case here.

    Write a Reply...