Re: Passing array to form

From: Date: Fri, 25 Apr 2003 14:33:57 +0000
Subject: Re: Passing array to form
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-145265@lists.php.net to get a copy of this message
At 17:25 25.04.2003, GeneralX spoke out and said: --------------------[snip]-------------------- >I can't seem to get the array in form to work, could use your help, thanks. > >1st file name: var_form.inc >--------------------------- ><? >$forminfo = <<<EOD ><form method="POST" action="$PHP_SELF"> >........ ><input type="text" name="userEdit[FName]" >value="$userEdit[FName]" >size="20"> ><input type="text" name="userEdit[LName]" >value="$userEdit[LName]" >size="20"> >........ >EOD; >?> --------------------[snip]-------------------- Within double-quoted strings (this is valid for heredoc as well) you need to put the array deref's between curly quotes. Note that I have single-quoted the array keys so PHP will not look for defined constants. This example will work: $forminfo = <<<EOD <form method="POST" action="$PHP_SELF"> ........ <input type="text" name="{userEdit['FName']}" value="{$userEdit['FName']}" size="20"> <input type="text" name="{userEdit['LName']}" value="{$userEdit['LName']}" size="20"> ........ EOD; -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#145265) next »