Variables with - in their name
| From: | Ron Piggott | Date: | Sun, 18 Nov 2012 06:09:11 +0000 |
| Subject: | Variables with - in their name | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-319730@lists.php.net to get a copy of this message | ||
I have made the following variable in a form: (I am referring the <select> )
<?php
$row['promo_code_prefix'] = 42;
$row['promo_code_suffix'] = 2;
echo "<select name=\"distributor-" . $row['promo_code_prefix'] .
"-" . $row['promo_code_suffix'] . "\" style=\"text-align:
center;\">\r\n";
?>
It could be wrote:
<?php
echo $distributor-42-2;
?>
Only PHP is treating the hyphen as a minus sign --- which in turn is causing a syntax error.
How do I retrieve the value of this variable and over come the “minus” sign that is really a
hyphen?
Ron
Ron Piggott
www.TheVerseOfTheDay.info