Re: Completing form prompts from array - error!

From: Date: Tue, 28 Nov 2000 22:45:04 +0000
Subject: Re: Completing form prompts from array - error!
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-27711@lists.php.net to get a copy of this message
Use . or , to embed complex data structures into a string. "blah blah $foo blah blah" is really only a convenience for simple variables, not arrays and objects etc. ----- Original Message ----- From: Miles Thompson <milesthompson@sprint.ca> Newsgroups: php.general Sent: Tuesday, November 28, 2000 3:50 PM Subject: [PHP] Completing form prompts from array - error! > 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 > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#27711) next »