Completing form prompts from array - error!
| From: | Miles Thompson | Date: | Tue, 28 Nov 2000 21:52:20 +0000 |
| Subject: | Completing form prompts from array - error! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27685@lists.php.net to get a copy of this message | ||
I'm borrowing Julie Meloni's technique of defining a form and assigning it to a variable,
but want to
enhance it by providing the form prompts from an array. This will allow me to accomodate different
languages.
Here's a code fragment ...
$user_form = "
<form method=\"post\" action=\"$PHP_SELF\">
<P> $arr_lbl[ lbl_cUsername ]
<input type=\"text\" name=\"$cUsername\" size=10></p>
<P>Email ... and so on to the end of the form ...
</form>";
The problem lies with --> $arr_lbl[ lbl_cUsername ] <-- which is returning this error:
Parse error: parse error, expecting
T_STRING' or T_VARIABLE' or
`T_NUM_STRING' in
/usr/local/apache/htdocs/auction/user_register.php on line 122.
I've also tried it with
$arr_lbl[ \"lbl_cUsername\" ]
$arr_lbl[ 'lbl_cUsername' ]
.
.
.
\"$arr_lbl[ lbl_cUsername ]\"
All this is very puzzling, because just ahaed of the form the statement
echo $arr_lbl[ lbl_cUsername ]
works fine and prints out "Username".
Any suggestions?
TIA - Miles Thompson